Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
dmapi / usr / lib / python2.7 / site-packages / dmapi / tests / fixtures.pyo
Size: Mime:
ó
mcc@@sÎdZddlmZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlm
ZddlZddlmZddlmZddlZddlmZdd	lmZdd
lmZddlmZddlm Z dd
l!m"Z"ddl#m$Z%ddl&m'Z'ddl(m)Z*ddl+m,Z,ddl-m.Z.ddl/m0Z
ddl+m1Z1ddl2m3Z4ddl+m5Z5ddl6m7Z8ddl6m9Z:ddl+m;Z<ddl+m=Z=ddl+m9Z9ddl>m?Z?ddl@mAZAddl+mBZBdmZCejDZDid"d#6d"d$6aEeFaGd%ejHfd&„ƒYZId'ejJfd(„ƒYZKd)ejHfd*„ƒYZLd+ejHfd,„ƒYZMd-ejHfd.„ƒYZNd/ejHfd0„ƒYZOd1ejHfd2„ƒYZPd3e=jQfd4„ƒYZRd5ejHfd6„ƒYZSd7ejHfd8„ƒYZTd9ejHfd:„ƒYZUd;ejHfd<„ƒYZVd=ejHfd>„ƒYZWd?ejHfd@„ƒYZXdAejHfdB„ƒYZYdCejHfdD„ƒYZZdEejHfdF„ƒYZ[dGejHfdH„ƒYZ\dIejHfdJ„ƒYZ]dKe^fdL„ƒYZ_dMejHfdN„ƒYZ`dOejHfdP„ƒYZadQejHfdR„ƒYZbdSejHfdT„ƒYZcdUejHfdV„ƒYZddWejHfdX„ƒYZedYe^fdZ„ƒYZfd[ejHfd\„ƒYZgd]ejHfd^„ƒYZhd_ejHfd`„ƒYZidaejHfdb„ƒYZjdce^fdd„ƒYZkdeejHfdf„ƒYZldgejmfdh„ƒYZndiejHfdj„ƒYZodkejHfdl„ƒYZpdS(nsFixtures for Nova tests.i(tabsolute_importN(tcontextmanager(tsession(t	lockutils(tcfg(tconffixture(tdaemon(t	uuidutils(tadapters(tinterceptor(ttenant_networks(tdeploy(twsgi_app(trpcapi(tcontext(t	migration(tapi(t	exception(tmodel(tobjects(tbase(tservice(tquota(trpc(tclient(tuuidsentinel(twsgitTruettruet1tyesttmainRtServiceFixturecB@s#eZdZdd„Zd„ZRS(s Run a service as a test fixture.cK@sC|}|p|}|jd|ƒ|jdd|ƒ||_dS(Nthosttbinarysnova-%s(t
setdefaulttkwargs(tselftnameR"R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt__init__8s
cC@sOtt|ƒjƒtjj|j|_|jjƒ|j|jj	ƒdS(N(
tsuperR!tsetUpRtServicetcreateR%tstartt
addCleanuptkill(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*Bs
N(t__name__t
__module__t__doc__tNoneR(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR!5s
tNullHandlercB@s)eZdZd„Zd„Zd„ZRS(sÜcustom default NullHandler to attempt to format the record.

    Used in conjunction with
    log_fixture.get_logging_handle_error_fixture to detect formatting errors in
    debug level logs without saving the logs.
    cC@s|j|ƒdS(N(tformat(R&trecord((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pythandlePscC@sdS(N((R&R6((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytemitSscC@s
d|_dS(N(R3tlock(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt
createLockVs(R0R1R2R7R8R:(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR4Is		tStandardLoggingcB@seZdZd„ZRS(sÅSetup Logging redirection for tests.

    There are a number of things we want to handle with logging in tests:

    * Redirect the logging to somewhere that we can test or dump it later.

    * Ensure that as many DEBUG messages as possible are actually
       executed, to ensure they are actually syntactically valid (they
       often have not been).

    * Ensure that we create useful output for tests that doesn't
      overwhelm the testing system (which means we can't capture the
      100 MB of debug logging on every run).

    To do this we create a logger fixture at the root level, which
    defaults to INFO and create a Null Logger at DEBUG which lets
    us execute log messages at DEBUG but not keep the output.

    To support local debugging OS_DEBUG=True can be set in the
    environment, which will print out the full debug logging.

    There are also a set of overrides for particularly verbose
    modules to be even less than INFO.

    cC@s tt|ƒjƒtjƒ}|jtjƒtjj	dƒt
krStj}n	tj}d}|jt
jd|ddƒƒ|_|jdj|ƒ|tjkrútƒ}|jt
j|dtƒƒ|jtjƒtjdƒjtjƒnd„}|jt
jd	|ƒƒdS(
NtOS_DEBUGs0%(asctime)s %(levelname)s [%(name)s] %(message)sR5tlevelit
nuke_handlerssmigrate.versioning.apicW@sdS(N((targs((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_logging_setupšssoslo_log.log.setup(R)R;R*tstd_loggingt	getLoggertsetLeveltDEBUGtostenvirontgett_TRUE_VALUEStINFOt
useFixturetfixturest
FakeLoggerR3tloggerthandlersR4t
LogHandlertFalsetWARNINGtMonkeyPatch(R&trootR=tfsthandlerR@((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*us&			(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR;ZstOutputStreamCapturecB@s5eZdZd„Zed„ƒZed„ƒZRS(sýCapture output streams during tests.

    This fixture captures errant printing to stderr / stdout during
    the tests and lets us see those streams at the end of the test
    runs instead. Useful to see what was happening during failed
    tests.
    cC@sÁtt|ƒjƒtjjdƒtkrh|jtj	dƒƒ|_
|jtjd|j
jƒƒntjjdƒtkr½|jtj	dƒƒ|_
|jtjd|j
jƒƒndS(NtOS_STDOUT_CAPTUREtstdouts
sys.stdouttOS_STDERR_CAPTUREtstderrs
sys.stderr(R)RVR*RERFRGRHRJRKtStringStreamtoutRRtstreamterr(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*©scC@s|jjdjƒS(NRZ(R^t_detailstas_text(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRZ´scC@s|jjdjƒS(NRX(R\R_R`(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRX¸s(R0R1R2R*tpropertyRZRX(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRV¡s	tTimeoutcB@s#eZdZdd„Zd„ZRS(sZSetup per test timeouts.

    In order to avoid test deadlocks we support setting up a test
    timeout parameter read from the environment. In almost all
    cases where the timeout is reached this means a deadlock.

    A class level TIMEOUT_SCALING_FACTOR also exists, which allows
    extremely long tests to specify they need more time.
    icC@sqtt|ƒjƒyt|ƒ|_Wntk
rBd|_nX|dkra|j|9_ntdƒ‚dS(Niisscaling value must be >= 1(R)RbR(tintttest_timeoutt
ValueError(R&ttimeouttscaling((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(Ès

cC@sHtt|ƒjƒ|jdkrD|jtj|jdtƒƒndS(Nitgentle(R)RbR*RdRJRKR(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*Ôs(R0R1R2R(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRb½s	tDatabasePoisonFixturecB@seZd„Zd„ZRS(cC@s3tt|ƒjƒ|jtjd|jƒƒdS(NsCoslo_db.sqlalchemy.enginefacade._TransactionFactory._create_session(R)RiR*RJRKRRt_poison_configure(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ÛscO@stdƒ‚dS(NsÀThis test uses methods that set internal oslo_db state, but it does not claim to use the database. This will conflict with the setup of tests that do use the database and cause failures later.(t	Exception(R&tatk((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRjâs(R0R1R*Rj(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRiÚs	tSingleCellSimplecB@sqeZdZed„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Ze
d
„ƒZRS(s
Setup the simplest cells environment possible

    This should be used when you do not care about multiple cells,
    or having a "real" environment for tests that should not care.
    This will give you a single cell, and map any and all accesses
    to that cell (even things that would go to cell0).

    If you need to distinguish between cell0 and cellN, then you
    should use the CellDatabases fixture.

    If instances should appear to still be in scheduling state, pass
    instances_created=False to init.
    cC@s
||_dS(N(tinstances_created(R&Ro((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(scC@s÷tt|ƒjƒ|jtjd|jƒƒ|jtjd|jƒƒ|jtjd|jƒƒ|jtjd|j	ƒƒ|jtjd|j
ƒƒ|jtjd|jƒƒ|jtjd|jƒƒ|jtjdd	„ƒƒdS(
Ns-nova.objects.CellMappingList._get_all_from_dbs-nova.objects.CellMapping._get_by_uuid_from_dbs-nova.objects.HostMapping._get_by_host_from_dbs:nova.objects.InstanceMapping._get_by_instance_uuid_from_dbs?nova.objects.InstanceMappingList._get_by_instance_uuids_from_dbs(nova.objects.InstanceMapping._save_in_dbsnova.context.target_cellsnova.context.set_target_cellcS@sdS(N(R3(tctm((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt<lambda>(s(
R)RnR*RJRKRRt_fake_cell_listt_fake_cell_gett_fake_hostmapping_gett_fake_instancemapping_gett_fake_instancemapping_get_uuidst_fake_instancemapping_get_savet_fake_target_cell(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s2






cG@s1idd6dd6dd6dd6|jƒdd6S(	Nitidt
updated_att
created_atthost1R"itcell_mapping(R3Rs(R&R?((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRu*s

cC@sYidd6dd6dd6|d6|jr.dp1dd6dd6|jrQ|jƒpTdd	6S(
NiRzR{R|t
instance_uuidtcell_idtprojectt
project_idR~(R3RoRt(R&R((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt _fake_instancemapping_get_common1scG@s|j|dƒS(Niþÿÿÿ(Rƒ(R&R?((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRx=scG@s|j|dƒS(Niÿÿÿÿ(Rƒ(R&R?((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRv@scG@s$g|dD]}|j|ƒ^qS(Niÿÿÿÿ(Rv(R&R?tuuid((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRwCscG@s|jƒdS(Ni(Rs(R&R?((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRtGscG@s;idd6dd6dd6tjd6dd6dd	6d
d6gS(NiRzR{R|R„tonlycellR'sfake://nowhere/t
transport_urls
sqlite:///tdatabase_connection(R3Rtcell1(R&R?((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRsJs

cc@s	|VdS(N((R&Rttarget_cell((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRySs(R0R1R2RR(R*RuRƒRxRvRwRtRsRRy(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRnýs
									tCheatingSerializercB@s eZdZd„Zd„ZRS(sA messaging.RequestContextSerializer that helps with cells.

    Our normal serializer does not pass in the context like db_connection
    and mq_connection, for good reason. We don't really want/need to
    force a remote RPC server to use our values for this. However,
    during unit and functional tests, since we're all in the same
    process, we want cell-targeted RPC calls to preserve these values.
    Unless we had per-service config and database layer state for
    the fake services we start, this is a reasonable cheat.
    cC@s6tt|ƒj|ƒ}|j|d<|j|d<|S(s0Serialize context with the db_connection inside.t
db_connectiont
mq_connection(R)RŠtserialize_contextR‹RŒ(R&Rtvalues((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRes

cC@sFtt|ƒj|ƒ}|jddƒ|_|jddƒ|_|S(s7Deserialize context and honor db_connection if present.R‹RŒN(R)RŠtdeserialize_contexttpopR3R‹RŒ(R&RŽtctxt((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRls(R0R1R2RR(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRŠZs
	t
CellDatabasescB@s}eZdZd„Zd„Zed„ƒZdd„Zd„Z	dd„Z
ddd„Zed„Z
d	„Zd
„ZRS(sUCreate per-cell databases for testing.

    How to use::

      fix = CellDatabases()
      fix.add_cell_database('connection1')
      fix.add_cell_database('connection2', default=True)
      self.useFixture(fix)

    Passing default=True tells the fixture which database should
    be given to code that doesn't target a specific cell.
    cC@s.i|_d|_d|_tjƒ|_dS(N(t
_ctxt_mgrsR3t_last_ctxt_mgrt_default_ctxt_mgrRtReaderWriterLockt
_cell_lock(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(s			cC@s|tdsx|j|}|jƒjƒ}|jƒ}tjddƒdjd„|jj	ƒDƒƒtd<|j
ƒndS(NR tdatabaseRcs@s|]}|VqdS(N((t.0tline((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pys	<genexpr>–s(t	DB_SCHEMAR“tget_legacy_facadet
get_enginetconnectRtdb_synctjoint
connectiontiterdumptdispose(R&tconnection_strtctxt_mgrtenginetconn((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt
_cache_schemas

c
c@s—|jjƒ‚|dkr@|j||ƒ}|VWdQXdS|j|j}||_z$|j||ƒ}|VWdQXWd|j|_XWdQXdS(N(R—t
write_lockR3t_real_target_cellR“R‡R”R•(R&RR~RpR¥tccontext((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_wrap_target_cellšs	cC@s|j|}|S(N(R“(R&R¡R¥((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_wrap_create_context_manager²s
cC@sIy|jr|jSWntk
r'nX|jjƒ|jSWdQXdS(N(R‹tAttributeErrorR—t	read_lockR”(R&R((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_wrap_get_context_manager¶s	
cC@s.t|ƒ}tjtj||ddd|ƒS(s3Mirror rpc.get_server() but with our special sauce.texecutorteventlett
serializer(RŠt	messagingtget_rpc_serverRt	TRANSPORT(R&ttargett	endpointsR³((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_wrap_get_serverÈscC@s+t|ƒ}tjtj|d|d|ƒS(s3Mirror rpc.get_client() but with our special sauce.tversion_capR³(RŠR´t	RPCClientRR¶(R&R·RºR³((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_wrap_get_clientÑs
c@s¸tjƒ‰ˆ|j|<ˆ|_|jdks7|rCˆ|_n‡fd†}tjd|ƒN|j|ƒˆj	ƒj
ƒ}|jƒ|jƒ}|j
jtdƒWdQXdS(sõAdd a cell database to the fixture.

        :param connection_str: An identifier used to represent the connection
        string for this database. It should match the database_connection field
        in the corresponding CellMapping.
        c@sˆS(N((R(R¥(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytget_context_managerôss*nova.db.sqlalchemy.api.get_context_managerR N(Rtcreate_context_managerR“R”R•R3RKRRR¨RœRR£RžR¡t
executescriptR›(R&R¤tdefaultR½R¦R§((R¥s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytadd_cell_databaseÙs
	


cC@s¿tt|ƒjƒ|j|jƒtj|_|jt	j
d|jƒƒ|jt	j
d|jƒƒ|jt	j
d|j
ƒƒ|jt	j
d|jƒƒ|jt	j
d|jƒƒdS(Ns-nova.db.sqlalchemy.api.create_context_managers*nova.db.sqlalchemy.api.get_context_managersnova.context.target_cellsnova.rpc.get_serversnova.rpc.get_client(R)R’R*R.tcleanupRR‰RªRJRKRRR­R°R¬R¹R¼(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s$



cC@s@x9t|jjƒƒD]"}|jƒjƒ}|jƒqWdS(N(tlistR“RŽRœRR£(R&R¥R¦((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂsN(R0R1R2R(R¨RR¬R3R­R°R¹R¼RPRÁR*RÂ(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR’ts		
		*	tDatabasecB@s;eZddd„Zd„Zd„Zd„Zd„ZRS(R cC@s«tt|ƒjƒts/tjtƒtan||_|dkrŒ|dk	r}tj
d|ƒ}|jƒ}|j|_q§tj|_n|dkr§tj
|_ndS(s›Create a database fixture.

        :param database: The type of database, 'main' or 'api'
        :param connection: The connection string to use
        R R¡RN(R)RÄR(tSESSION_CONFIGUREDRt	configuretCONFRR˜R3R¾RœRtget_api_engine(R&R˜R¡R¥tfacade((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(#s
				cC@srt|jsn|jƒ}|jƒ}tjd|jƒdjd„|jjƒDƒƒt|j<|j	ƒndS(NR˜Rcs@s|]}|VqdS(N((R™Rš((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pys	<genexpr>Bs(
R›R˜RRžRRŸR R¡R¢R£(R&R¦R§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR¨<s
cC@s|jƒ}|jƒdS(N(RR£(R&R¦((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂFscC@sG|jƒ|jƒ}|jƒ|jƒ}|jjt|jƒdS(N(R¨RR£RžR¡R¿R›R˜(R&R¦R§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytresetJs


cC@s1tt|ƒjƒ|jƒ|j|jƒdS(N(R)RÄR*RÊR.RÂ(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*Qs
N(R0R1R3R(R¨RÂRÊR*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÄ"s
	
		tDatabaseAtVersioncB@s/eZdd„Zd„Zd„Zd„ZRS(R cC@s_tt|ƒjƒ||_||_|dkr@tj|_n|dkr[tj|_ndS(s¨Create a database fixture.

        :param version: Max version to sync to (or None for current)
        :param database: The type of database, 'main' or 'api'
        R RN(R)RËR(R˜tversionRRRÈ(R&RÌR˜((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(Xs		cC@s|jƒ}|jƒdS(N(RR£(R&R¦((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂfscC@s@|jƒ}|jƒ|jƒtjd|jd|jƒdS(NRÌR˜(RR£RžRRŸRÌR˜(R&R¦((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÊjs

cC@s1tt|ƒjƒ|jƒ|j|jƒdS(N(R)RËR*RÊR.RÂ(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ps
(R0R1R(RÂRÊR*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRËWs		tDefaultFlavorsFixturecB@seZd„ZRS(cC@s®tt|ƒjƒtjƒ}idd6td6td6dd6dd6}idd	6d
d6dd
6}tjd|dddddddddd|tjd|dddddddddd|tjd|dddddddddd |tjd|dd!dd"dd#dd$dd%|tjd|dd&dd'dd(dd)dd*|tjd|dddddddd+dd,d-||g}x|D]}|j	ƒq–WdS(.Ngð?trxtx_factortdisabledt	is_publicitephemeral_gbtswaptSandyBridgeshw:cpu_modelt2048shw:mem_page_sizet	dedicateds
hw:cpu_policyRt	memory_mbitvcpusitroot_gbtflavoridRR'sm1.tinyiit2sm1.smalliii(t3s	m1.mediumi iiPt4sm1.largei@ii t5s	m1.xlarget6s
m1.tiny.specstextra_specs(
R)RÍR*Rtget_admin_contextRPRRtFlavorR,(R&R‘tdefaultsRßtdefault_flavorstflavor((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ws8

(R0R1R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÍvst
RPCFixturecB@s#eZd„Zd„Zd„ZRS(cG@s9tt|ƒjƒg|_|jj|ƒi|_dS(N(R)RåR(texmodstextendt_buses(R&Ræ((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(šs	cC@sQd}||jkrFtjƒ}tjtd|d|ƒ|j|<n|j|S(Nturltallowed_remote_exmods(R3RèRtget_allowed_exmodsR´tget_rpc_transportRÇ(R&RéRæ((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_fake_create_transport scC@s¿tt|ƒjƒ|jtjƒtj|jŒ|jtjƒt	j
tƒ|_d|j_
|j|jƒ|jtjd|jƒƒtjdƒ}d|_tjtƒWdQXdS(Ntfakesnova.rpc.create_transportsnova.rpc.get_transport_url(R)RåR*R.RRÂtadd_extra_exmodsRætclear_extra_exmodstmessaging_conffixturetConfFixtureRÇtmessaging_confttransport_driverRJRKRRRítmocktpatchR3treturn_valuetinit(R&tmock_gtu((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*³s	(R0R1R(RíR*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRå™s		tWarningsFixturecB@seZdZd„ZRS(s&Filters out warnings during test runs.cC@sƒtt|ƒjƒtjdtƒtjdddƒtjdddƒtjdddƒtjdddƒ|jtjƒdS(	Ntoncetignoretmessages>With-statements now directly support multiple context managerstmodulet
pkg_resourcess“Policy enforcement is depending on the value of is_admin. This key is deprecated. Please update your policy file to use the standard policy values.smox3.mox(	R)RúR*twarningstsimplefiltertDeprecationWarningtfilterwarningsR.t
resetwarnings(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*És(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRúÆstConfPatchercB@s eZdZd„Zd„ZRS(sˆFixture to patch and restore global CONF.

    This also resets overrides for everything that is patched during
    it's teardown.

    cK@s5tt|ƒjƒ|jddƒ|_||_dS(sëConstructor

        :params group: if specified all config options apply to that group.

        :params **kwargs: the rest of the kwargs are processed as a
        set of key/value pairs to be set as configuration override.

        tgroupN(R)RR(RR3RR?(R&R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(ís	cC@sltt|ƒjƒxRt|jjƒƒD];\}}|jtj||j	ƒtj
|||j	ƒq)WdS(N(R)RR*RÃR?titemsR.RÇtclear_overrideRtset_override(R&Rmtv((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ús"(R0R1R2R(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRås	
tOSAPIFixturecB@s&eZdZddd„Zd„ZRS(s_Create an OS API server as a fixture.

    This spawns an OS API server as a fixture in a new greenthread in
    the current test. The fixture has a .api parameter with is a
    simple rest client that can communicate with it.

    This fixture is extremely useful for testing REST responses
    through the WSGI stack easily in functional tests.

    Usage:

        api = self.useFixture(fixtures.OSAPIFixture()).api
        resp = api.api_request('/someurl')
        self.assertEqual(200, resp.status_code)
        resp = api.api_request('/otherurl', method='POST', body='{foo}')

    The resp is a requests library response. Common attributes that
    you'll want to use are:

    - resp.status_code - integer HTTP status code returned by the request
    - resp.content - the body of the response
    - resp.headers - dictionary of HTTP headers returned

    tv2t 6f70656e737461636b20342065766572cC@s)tt|ƒjƒ||_||_dS(sêConstructor

        :param api_version: the API version that we're interested in
        using. Currently this expects 'v2' or 'v2.1' as possible
        options.
        :param project_id: the project id to use on the API.

        N(R)RR(tapi_versionR‚(R&RR‚((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(s
	c@s_tt|ƒjƒtj}d}d}d||f}i|d6|d6td6}|jt|ƒ|jtj	dt
jjƒƒt
jƒj|ƒ‰‡fd†}tjtj|ƒtj|d	|ƒ}|jƒ|j|jƒd
i|d6|d6|jd
6|_tjdd|j|jƒ|_tjdd|j|jƒ|_||_ dS(NiPt
osapi_computes
http://%s:%s/tosapi_compute_listentosapi_compute_listen_porttdebugs:keystoneauth1.session.TCPKeepAliveAdapter.init_poolmanagerc@sˆS(N(((tloader(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr?sRés(http://%(host)s:%(port)s/%(api_version)sR"tportRRîtadmin(!R)RR*Rt
osapi_hostRRJRRKRRRtHTTPAdaptertinit_poolmanagerRtLoadertload_appRt_setup_serviceRÇR"R	tRequestsInterceptortinstall_interceptR.tuninstall_interceptRtauth_urlRtTestOpenStackClientR‚Rt	admin_apitapp(R&thostnameRtservice_nametendpointtconf_overridesR"t	intercept((Rs8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*)s4	

(R0R1R2R(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRs
tOSMetadataServercB@seZdZd„ZRS(s9Create an OS Metadata API server as a fixture.

    This spawns an OS Metadata API server as a fixture in a new
    greenthread in the current test.

    TODO(sdague): ideally for testing we'd have something like the
    test client which acts like requests, but connects any of the
    interactions needed.

    cC@s°tt|ƒjƒidd6dd6td6}|jt|ƒ|jtjdd„ƒƒtj	dƒ|_
|j
jƒ|j|j
j
ƒd	|d|j
jf|_dS(
Ns	127.0.0.1tmetadata_listenitmetadata_listen_portRs-nova.network.linux_net.IptablesManager._applycS@sdS(N(R3(t_((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrmstmetadatas
http://%s:%s/(R)R(R*RRJRRKRRRtWSGIServiceR,R-R.tstopRtmd_url(R&R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*^s


(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(Ss
tPoisonFunctionscB@seZdZd„ZRS(sPoison functions so they explode if we touch them.

    When running under a non full stack test harness there are parts
    of the code that you don't want to go anywhere near. These include
    things like code that spins up extra threads, which just
    introduces races.

    cC@sEtt|ƒjƒddl}d„}|jtjd|ƒƒdS(Nic_@s*ddl}tjdƒ|jdƒdS(Nis&Forgot to disable libvirt event threadi(tsysRtwarntexit(R?R%R1((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytevloops
s(nova.virt.libvirt.host.Host._init_events(R)R0R*tnova.virt.libvirt.hostRJRKRR(R&tnovaR4((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s		(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR0wstIndirectionAPIFixturecB@s)eZdZd„Zd„Zd„ZRS(s8Patch and restore the global NovaObject indirection api.cC@s tt|ƒjƒ||_dS(s`Constructor

        :param indirection_api: the indirection API to be used for tests.

        N(R)R7R(tindirection_api(R&R8((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(šscC@s|jtj_dS(N(torig_indirection_apitobj_baset
NovaObjectR8(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR£scC@sEtt|ƒjƒtjj|_|jtj_|j|jƒdS(N(	R)R7R*R:R;R8R9R.RÂ(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*¦s(R0R1R2R(RÂR*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR7—s			t_FakeGreenThreadcB@s>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cO@s|||Ž|_dS(N(t_result(R&tfuncR?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(®scO@sdS(N((R&R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytcancel±scO@sdS(N((R&R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR/¶scO@s||||ŽdS(N((R&R>R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytlink»scO@sdS(N((R&R>R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytunlink¾scC@s|jS(N(R=(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytwaitÃs(R0R1R(R?R/R@RARB(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR<­s					tSpawnIsSynchronousFixturecB@seZdZd„ZRS(s>Patch and restore the spawn_n utility method to be synchronouscC@sItt|ƒjƒ|jtjdtƒƒ|jtjdtƒƒdS(Nsnova.utils.spawn_nsnova.utils.spawn(R)RCR*RJRKRRR<(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*Ês

(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRCÇstBannedDBSchemaOperationscB@s2eZdZdd„Zed„ƒZd„ZRS(s"Ban some operations for migrationscC@s&tt|ƒjƒ|pg|_dS(N(R)RDR(t_banned_resources(R&tbanned_resources((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(ÔscC@stjd||fƒ‚dS(Ns8Operation %s.%s() is not allowed in a database migration(RtDBNotAllowed(tresourcetop((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_explodeØsc@s}ttˆƒjƒxcˆjD]X‰ˆjtjdˆ‡‡fd†ƒƒˆjtjdˆ‡‡fd†ƒƒqWdS(Nssqlalchemy.%s.dropc@sˆjˆdƒS(Ntdrop(RJ(RlRm(R&tthing(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrãsssqlalchemy.%s.alterc@sˆjˆdƒS(Ntalter(RJ(RlRm(R&RL(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRræs(R)RDR*RERJRKRR(R&((R&RLs8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ÞsN(R0R1R2R3R(tstaticmethodRJR*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRDÒst"ForbidNewLegacyNotificationFixturecB@s)eZdZd„Zd„Zd„ZRS(s<Make sure the test fails if new legacy notification is addedcC@s#tt|ƒjƒtj|_dS(N(R)ROR(RtLegacyValidatingNotifiertnotifier(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(ëscC@sFtt|ƒjƒt|j_|jjjdƒ|j|j	ƒdS(Nt_decorated_function(
R)ROR*RRQtfatalt'allowed_legacy_notification_event_typestappendR.RÂ(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*ïs
cC@s#t|j_|jjjdƒdS(NRR(RPRQRSRTtremove(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂús(R0R1R2R(R*RÂ(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyROés		tAllServicesCurrentcB@seZd„Zd„ZRS(cC@s<tt|ƒjƒ|jtjd|jƒƒdt_	dS(Ns.nova.objects.Service.get_minimum_version_multi(
R)RWR*RJRKRRt
_fake_minimumR3tcompute_rpcapitLAST_VERSION(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s

cO@stjS(N(tservice_objtSERVICE_VERSION(R&R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRXs(R0R1R*RX(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRWs	tRegisterNetworkQuotacB@seZd„Zd„ZRS(cC@s1tt|ƒjƒtjƒ|j|jƒdS(N(R)R]R*R
t_register_network_quotaR.RÂ(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*
s
cC@stjjjddƒdS(Ntnetworks(t
nova_quotatQUOTASt
_resourcesRR3(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂs(R0R1R*RÂ(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR]s	tNeutronFixturecB@seZdZdZidd6gd6dd6ed6ed6d	d
6Zidd6ed6ed
d
6ed6gd6idd6dd6gd6gd6dd6dd6dd6dd
6Zed
ged<idd
6ed
d
6ed6dd6dd6idd6ed
d 6gd!6ed6Zid"d
6ed
d
6ed6dd6d#d6id$d6ed
d 6gd!6ed6Ziid%6d&d'6e	d(6id)d*6iiid+6dd,6d-d.6gd/6d0d16gd26dd,6id+6gd36gd46d5d6iid+6dd,6d6d.6d7d16d66gd6ie	d86ed6d9d:6d+6d;d
6d<d=6d>6d?d@6dAdB6dXdC6id+6iedD6edE6dF6dGd16edH6dId.6d&d
6dXdJ6gZdK„ZdL„Z
dM„ZdN„ZdO„ZdP„ZdQ„ZedR„ZedS„ZedT„ZedU„ZdV„ZdXdW„ZRS(Ys.A fixture to boot instances with neutron portsR
tACTIVEtstatustsubnetssprivate-networkR'tadmin_state_upt	tenant_ids$3cb9bc59-5699-4588-a4b1-b87f96708bc6Rzsprivate-subnettenable_dhcpt
network_idtdns_nameserverss192.168.1.1R-s
192.168.1.254tendtallocation_poolsthost_routesit
ip_versiont
gateway_ips192.168.1.1/24tcidrs$f8a6e8f8-c2ec-497c-9f23-da9616de54efs$ce531f90-199f-48c0-816c-13e38010b442sfa:16:3e:4c:2c:30tmac_addresss192.168.1.3t
ip_addresst	subnet_idt	fixed_ipss$88dae9fa-0dc6-49e3-8c29-3abc41e99ac9s00:0c:29:0d:11:74s192.168.1.30tprofiles$b71f1699-42be-4515-930a-f3ef01f94aa7tovs_interfaceidtpreserve_on_deletesbr-inttbridgetmetaRÌtfixedttypetfloating_ipss10.0.0.4taddresstipstdnstroutess10.0.0.0/26tgateways10.0.0.1tinjectediÜtmtus$e1882e38-38c2-4239-ade7-35d644cb963atpublictlabeltnetworkstapb71f1699-42tdevnametnormalt	vnic_typet
qbh_paramstport_filtertovs_hybrid_plugtdetailssfa:16:3e:47:94:4atactivetovst
qbg_paramscC@shtt|ƒjƒ||_tjtjƒg|_g|_tj	g|_
tjg|_g|_
dS(N(R)RcR(ttesttcopytdeepcopytport_1t_portst_extensionst	network_1t	_networkstsubnet_1t_subnetst_floatingips(R&R’((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(Šs		c@sãttˆƒjƒˆjjdd„ƒˆjjdd„ƒˆjjdd„ƒˆjjdd„ƒˆjjd	d
„ƒˆjjdd„ƒˆjjd
d„ƒˆjjdd„ƒˆjjd‡fd†ƒdS(Ns0nova.network.neutronv2.api.API.validate_networksc_@sdS(Ni((R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr™ssBnova.network.neutronv2.api.API.create_pci_requests_for_sriov_portsc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrss5nova.network.neutronv2.api.API.setup_networks_on_hostc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr ss5nova.network.neutronv2.api.API.migrate_instance_startc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr£ss7nova.network.neutronv2.api.API.add_fixed_ip_to_instancec_@stjjtjƒS(N(t
network_modeltNetworkInfothydrateRctnw_info(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr¦s	s<nova.network.neutronv2.api.API.remove_fixed_ip_from_instancec_@stjjtjƒS(N(RRžRŸRcR (R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrªs	s6nova.network.neutronv2.api.API.migrate_instance_finishc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr®ssbnova.network.security_group.neutron_driver.SecurityGroupAPI.get_instances_security_groups_bindingsc_@siS(N((R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr²ss%nova.network.neutronv2.api.get_clientc@sˆS(N((R?R%(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrµs(R)RcR*R’tstub_out(R&((R&s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*“s6	
	
	
	
	
	
	
	
cC@sKg|D]}|d|kr|^q}t|ƒdkrC|dSdSdS(NRzi(tlenR3(R&RzRÃtpt
filtered_list((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_get_first_id_match·s)cK@sftj|jƒ}xF|D]>}g|D]%}|j|ƒ||kr&|^q&}|}qWi|d6S(Ntports(R“R”R–RG(R&t_paramsR¦toptR£tfiltered_ports((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt
_filter_ports¾s

2
cO@stji|jd6ƒS(Nt
extensions(R“R”R—(R&R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytlist_extensionsÅscK@sA|j||jƒ}|dkr6tjd|ƒ‚ni|d6S(Ntport_idR(R¥R–R3RtPortNotFound(R&R­R§R((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt	show_portÈscK@s;x4|jD])}|d|kr
|jj|ƒq
q
WdS(NRz(R–RV(R&RR§tcurrent_port((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytdelete_portÎscK@stji|jd6ƒS(NR_(R“R”R™(R&tretrieve_allR§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt
list_networksÓscK@s
|j|S(N(Rª(R&R²R§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt
list_portsÖscK@stji|jd6ƒS(NRf(R“R”R›(R&R²R§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytlist_subnetsÙscK@stji|jd6ƒS(Ntfloatingips(R“R”Rœ(R&R²R§((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytlist_floatingipsÜscO@s3|jjtjtjƒƒtjitjd6ƒS(NR(R–RUR“R”Rctport_2(R&R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytcreate_portßscC@s`|j||jƒ}|dk	rUx1t|djƒƒD]\}}|||<q8Wni|d6S(NR(R¥R–R3RÃR(R&R­tbodytnew_portRmR
((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytupdate_portãs
#N(R0R1R2RhRR˜RšR•R¸RPR3R R(R*R¥RªR¬R¯R±R³R´RµR·R¹R¼(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRcsÄ




			$						t_NoopConductorcB@seZd„ZRS(cC@s
d„}|S(Nc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt	_noop_rpcïs((R&tkeyR¾((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt__getattr__îs	(R0R1RÀ(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR½ístNoopConductorFixturecB@seZdZd„ZRS(s(Stub out the conductor API to do nothingcC@sItt|ƒjƒ|jtjdtƒƒ|jtjdtƒƒdS(Nsnova.conductor.ComputeTaskAPIsnova.conductor.API(R)RÁR*RJRKRRR½(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*÷s

(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÁôstEventReporterStubcB@seZd„ZRS(cC@s3tt|ƒjƒ|jtjdd„ƒƒdS(Ns nova.compute.utils.EventReporterc_@s
tjƒS(N(Rõt	MagicMock(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrs(R)RÂR*RJRKRR(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s(R0R1R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÂÿst
CinderFixturecB@sDeZdZdZdZdZdZdZdZd„Z	d„Z
RS(	sA fixture to volume operationsR
s$a07f71dc-8151-4e7d-a0cc-cd24a3f11113s$227cc671-f30b-4488-96fd-7d0bf13648d8s$828419fa-3efb-4533-b458-4267ca5fe9b1s$9c6d9c2d-7a8f-4c80-938d-3bf062b8d489s$6ca404f3-d844-4169-bb96-bc792f37de98cC@sYtt|ƒjƒ||_t|_d|_d|_t	ƒ|_
tjt	ƒ|_
dS(N(R)RÄR(R’RPt
swap_errorR3tswap_volume_instance_uuidtswap_volume_instance_error_uuidRÃtreserved_volumestcollectionstdefaultdicttattachments(R&R’((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(s				c@s]ttˆƒjƒd‡fd†}d„}d„}‡fd†}‡fd†}d‡fd†}ˆjjd|ƒdd‡fd	†}ˆjjd
|ƒˆjjdd„ƒˆjjd
|ƒˆjjd|ƒˆjjd|ƒˆjjd|ƒˆjjdd„ƒˆjjdd„ƒˆjjd|ƒˆjjdd„ƒdS(Nc	@sÕ|tjtjfkr×idd6dd6dd6|d6td6d	d
6}ˆjr`|tjksxˆjr×|tjkr×|tjkrˆjnˆj}|jidd6iidd
6|d6|6d6dd6ƒ|SnxÊtˆjj	ƒƒD]h\}}||kríidd6|d6dd6|d6td6d	d
6ii|d6dd
6|6d6}PqíqíW|ˆj
k}i|rwdndd6dd6dd6|d6td6d	d
6}|ˆjkrÑt|d<idd6|d<n|S(Nt	availableRetTEST1tdisplay_nametdetachedt
attach_statusRztmultiattachitsizesin-uses/dev/vdbt
mountpointt
attachment_idRËtattachedt	attachingtTEST2tbootables$155d900f-4e14-4e4c-a73d-069cbf4541e6timage_idtvolume_image_metadata(
RÄtSWAP_OLD_VOLtSWAP_ERR_OLD_VOLRPRÆRÇtupdateRÃRËRRÈtIMAGE_BACKED_VOLR(tself_apiRt	volume_idtmicroversiontvolumeRtvolumestreserved_volume(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_get%sd	
				"

cS@s|tjkrdSiS(N((RÄtSWAP_ERR_NEW_VOL(R&RRàt	connector((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_initialize_connectionpscS@si|d6S(Ntsave_volume_id((R&Rt
old_volume_idt
new_volume_idterror((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_migrate_volume_completionvsc@sˆjj|ƒdS(N(RÈRU(RßRRà(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_reserve_volumezsc@s/|ˆjkr"ˆjj|ƒntˆ_dS(N(RÈRVRRÅ(RßRRà(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_unreserve_volume}strwc@sixNtˆjjƒƒD]7\}}||krtjdd||fƒ‚qqWˆj|j|ƒdS(Ntreasons,Volume %s is already attached to instance %s(RÃRËRRtInvalidInputRU(t_selfRRàRRÓtmodetinstanceRã(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_attach‰s"	snova.volume.cinder.API.attachc@sŒ|ˆjkr"ˆjj|ƒn|dk	rEˆj|j|ƒnCx@tˆjjƒƒD])\}}||kr[|j|ƒPq[q[WdS(N(RÈRVR3RËRÃR(RóRRàRRÔRõRã(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_detach—s"
snova.volume.cinder.API.detachs&nova.volume.cinder.API.begin_detachingc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr­ssnova.volume.cinder.API.gets,nova.volume.cinder.API.initialize_connections0nova.volume.cinder.API.migrate_volume_completions%nova.volume.cinder.API.reserve_volumes%nova.volume.cinder.API.roll_detachingc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr¸ss+nova.volume.cinder.API.terminate_connectionc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrºss'nova.volume.cinder.API.unreserve_volumes%nova.volume.cinder.API.check_attachedc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr¾s(R)RÄR*R3R’R¡(R&RåRèRíRîRïRöR÷((R&s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*"s>K		


	

(R0R1R2RhRÛtSWAP_NEW_VOLRÜRæRÞR(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÄs	tCinderFixtureNewAttachFlowcB@sPeZdZdZdZdZdZdZdZdZ	dZ
d	„Zd
„ZRS(sDA fixture to volume operations with the new Cinder attach/detach APIR
s$a07f71dc-8151-4e7d-a0cc-cd24a3f11113s$227cc671-f30b-4488-96fd-7d0bf13648d8s$828419fa-3efb-4533-b458-4267ca5fe9b1s$9c6d9c2d-7a8f-4c80-938d-3bf062b8d489s$4a3cd440-b9c2-11e1-afa6-0800200c9a66s$4757d51f-54eb-4442-8684-3399a6431f67s$6ca404f3-d844-4169-bb96-bc792f37de98cC@sVtt|ƒjƒ||_t|_d|_d|_d|_	t
jtƒ|_
dS(N(R)RùR(R’RPRÅR3RÆRÇtattachment_error_idRÉRÊRÃRË(R&R’((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(Õs					c@sKttˆƒjƒd‡fd†}d„}dd‡fd†}‡fd†}dd„}d„}ˆjjd|ƒˆjjd|ƒˆjjd	|ƒˆjjd
d„ƒˆjjd|ƒˆjjd
d„ƒˆjjd|ƒˆjjd|ƒˆjjdd„ƒˆjjdd„ƒˆjjdd„ƒdS(Nc	@sÌ|tjtjfkr×idd6dd6dd6|d6td6d	d
6}ˆjr`|tjksxˆjr×|tjkr×|tjkrˆjnˆj}|jidd6iidd
6|d6|6d6dd6ƒ|SnxÁtˆjj	ƒƒD]q\}}||kríidd6|d6dd6|d6|ˆj
kd6d	d
6ii|d6dd
6|6d6}PqíqíWidd6dd6dd6|d6|ˆj
kd6d	d
6}|ˆjkrÈt|d<idd6|d<n|S(NRÌReRÍRÎRÏRÐRzRÑiRÒsin-uses/dev/vdbRÓRÔRËRÕR×RØs$155d900f-4e14-4e4c-a73d-069cbf4541e6RÙRÚ(
RÄRÛRÜRPRÆRÇRÝRÃRËRtMULTIATTACH_VOLRÞR(RßRRàRáRâRRã(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRåãsb	
				"

cS@si|d6S(NRé((R&RRêRëRì((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRí-sc@sntjƒ}ˆjdk	r'ˆj}ni|d6iid6d6}ˆjdj|ƒˆj|j|ƒ|S(NRztdatatconnection_infoR(Rt
generate_uuidRúR3RËRU(RóRRàRRçRÓRÔt
attachment(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_attachment_create1sc@sLˆjdd}ˆj|d=ˆjdd=|tjkrHtˆ_ndS(NRi(RËRùtSWAP_ERR_ATTACH_IDRRÅ(RóRRÔR(R&(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_attachment_delete<s
cS@sSidd6|d6iidd6dd6d6d	6}|tjkrOid
d	6}n|S(Nt	fake_typetdriver_volume_typeRztbartfooRt
target_lunRüRý((RùR(RóRRÔRçRÓtattachment_ref((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_attachment_updateCs

cS@s4idd6|d6iidd6dd6d6d	6}|S(
NRRRzRRRRRüRý((RóRRÔR((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytfake_attachment_getNs

s(nova.volume.cinder.API.attachment_creates(nova.volume.cinder.API.attachment_deletes(nova.volume.cinder.API.attachment_updates*nova.volume.cinder.API.attachment_completec_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRr]ss%nova.volume.cinder.API.attachment_gets&nova.volume.cinder.API.begin_detachingc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrassnova.volume.cinder.API.gets0nova.volume.cinder.API.migrate_volume_completions%nova.volume.cinder.API.roll_detachingc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrhss,nova.volume.cinder.is_microversion_supportedc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrjss%nova.volume.cinder.API.check_attachedc_@sdS(N(R3(R?R%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrls(R)RùR*R3R’R¡(R&RåRíRRR	R
((R&s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*às<J	

	

	

(
R0R1R2RhRÛRøRÜRæRRûRÞR(R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRùÄs	tPlacementApiClientcB@s#eZd„Zd„Zd„ZRS(cC@s
||_dS(N(tfixture(R&tplacement_fixture((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(pscK@stj|jjd||ƒS(N(RtAPIResponseRt	_fake_getR3(R&RéR%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRGsscK@s"tj|jjd|||ƒS(N(RRRt	_fake_putR3(R&RéRºR%((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pytputvs(R0R1R(RGR(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRos		tPlacementFixturecB@sVeZdZdd„Zd„Zed„ƒZd„Zd„Zd„Z	d„Z
RS(	sjA fixture to placement operations.

    Runs a local WSGI server bound on a free port and having the Placement
    application with NoAuth middleware.
    This fixture also prevents calling the ServiceCatalog for getting the
    endpoint.

    It's possible to ask for a specific token when running the fixtures so
    all calls would be passing this token.
    RcC@s
||_dS(N(ttoken(R&R((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(‡sc@sLtt|ƒjƒ|jtddddƒƒtjtƒ‰‡fd†}tj	}d||_
tj|d|j
ƒ}|j
ƒ|j|jƒ|jtjdtjjƒƒtjd	dƒ|_|jtjd
|jƒƒ|jtjd|jƒƒ|jtjd|jƒƒ|jtjd
|jƒƒt|ƒ|_dS(NRRt
auth_strategytnoauth2c@sˆS(N(((R(s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRrsshttp://%s/placementRés:keystoneauth1.session.TCPKeepAliveAdapter.init_poolmanagertauths6nova.scheduler.client.report.SchedulerReportClient.gets7nova.scheduler.client.report.SchedulerReportClient.posts6nova.scheduler.client.report.SchedulerReportClient.puts9nova.scheduler.client.report.SchedulerReportClient.delete(R)RR*RJRtplacement_deploytloadappRÇRtplacement_hostR%R	RRR.RRKRRRRRtkstSessionR3t_clientRt
_fake_postRt_fake_deleteRR(R&R"R"R'((Rs8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*Šs4	





cK@s:|jdƒ}|dk	r6|jid|d6ƒndS(NRÌsplacement %ssOpenStack-API-Version(RGR3RÝ(theadersR%RÌ((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt_update_headers_with_version°s	cO@sR|d\}i|jd6}|j|||jj|d|jd|dtƒS(Nisx-auth-tokentendpoint_overrideRt	raise_exc(RR RRGR%RP(R&R?R%RéR((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR¹s
		c
O@s[|d\}}i|jd6}|j|||jj|d|d|jd|dtƒS(Nisx-auth-tokentjsonR!RR"(RR RtpostR%RP(R&R?R%RéRüR((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRÆs		c
O@s[|d\}}i|jd6}|j|||jj|d|d|jd|dtƒS(Nisx-auth-tokenR#R!RR"(RR RRR%RP(R&R?R%RéRüR((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR×s		cO@s<|d\}|jj|d|jdi|jd6dtƒS(NiR!Rsx-auth-tokenR"(RtdeleteR%RRP(R&R?R%Ré((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyRès
		(R0R1R2R(R*RNR RRRR(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR{s
	&		
		tUnHelperfulClientChannelcB@seZd„ZRS(cC@stdƒ‚dS(NsYou have attempted to start a privsep helper. This is not allowed in the gate, and indicates a failure to have mocked your tests.(Rk(R&R((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(õs(R0R1R((((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR&ôstPrivsepNoHelperFixturecB@seZdZd„ZRS(s¢A fixture to catch failures to mock privsep's rootwrap helper.

    If you fail to mock away a privsep'd method in a unit test, then
    you may well end up accidentally running the privsep rootwrap
    helper. This will fail in the gate, but it fails in a way which
    doesn't identify which test is missing a mock. Instead, we
    raise an exception so that you at least know where you've missed
    something.
    cC@s0tt|ƒjƒ|jtjdtƒƒdS(Ns)oslo_privsep.daemon.RootwrapClientChannel(R)R'R*RJRKRRR&(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR'ûs	tNoopQuotaDriverFixturecB@seZdZd„ZRS(sÎA fixture to run tests using the NoopQuotaDriver.

    We can't simply set self.flags to the NoopQuotaDriver in tests to use the
    NoopQuotaDriver because the QuotaEngine object is global. Concurrently
    running tests will fail intermittently because they might get the
    NoopQuotaDriver globally when they expected the default DbQuotaDriver
    behavior. So instead, we can patch the _driver property of the QuotaEngine
    class on a per-test basis.
    cC@s_tt|ƒjƒ|jtjdtjƒƒƒtj	dddƒ|j
tjddƒdS(Nsnova.quota.QuotaEngine._drivertdriversnova.quota.NoopQuotaDriverR(R)R(R*RJRKRRR`tNoopQuotaDriverRÇR	R.R(R&((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR*s
(R0R1R2R*(((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyR(s	(sTrueRRsyes(qR2t
__future__RRÉt
contextlibRR“tloggingRARERRKt
keystoneauth1RRRõtoslo_concurrencyRtoslo_configRtoslo_messagingR´RRñtoslo_privsepRtprivsep_daemont
oslo_utilsRtrequestsRtwsgi_interceptR	tnova.api.openstack.computeR
tnova.api.openstack.placementRRtnova.api.openstackRtnova.computeR
RYR6Rtnova.dbRtnova.db.sqlalchemyRRtnova.networkRRRtnova.objectsRR:RR[RR`Rtnova.tests.functional.apiRt
nova.testsRRRHRÇR›RPRÅtFixtureR!tHandlerR4R;RVRbRiRntRequestContextSerializerRŠR’RÄRËRÍRåRúRRR(R0R7tobjectR<RCRDRORWR]RcR½RÁRÂRÄRùRRt_ClientChannelR&R'R((((s8/usr/lib/python2.7/site-packages/dmapi/tests/fixtures.pyt<module>s˜	G#]®5#-R$ Õ	¼«y