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    
Size: Mime:
ó
±EYc@sodZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddl
ZddlmZddlZddlZddlmZddlmZddlZddlmZddlmZddlmZdd	lmZdd
lm Z ddlm!Z!ddl"Z"ddl#m$Z$dd
l%m&Z&ddl'm(Z)ddl*m+Z+ddl%m,Z,ddl-m.Z.ddl-m/Z/ddl-m0Z0ddl-m1Z1ddl-m(Z2ddl-m3Z3ddl-m4Z5ddl6m7Z7ddl-m8Z8ddl%m9Z9ddl:Z%ddl%m;Z;ddl<Z%ddl%m=Z=ddl%m>Z>ddl%m?Z?ddl@mAZAddl@mBZBdd l@mCZCdd!l@mDZDdd"l%mEZEdd#lFmGZGdd$l%mHZHdd%l%mIZIdd&lJmKZLdd'lJmMZNdd(lOmPZPdd)l%mQZQdd*lRmSZTdd+lRmUZUdd,lRmVZWdd-lRmXZYdd.lZm[Z[dd/l%m\Z\dd0l%m]Z]dd1l^m_Z`ddl%m4Z4dd
lam&Zbdd2lamcZcdd3lamdZddd4lameZfdd5lamgZgdd6lamhZhdd7limjZjdd8limkZke%jljmZmejneoƒZpejqe\jrd9d:ƒZrejqe>jsd;erd<d=ƒZse4jtd>ƒd?„ƒZue4jtd@ƒdA„ƒZve4jtd@ƒdB„ƒZwe4jtdCd@ƒdD„ƒZxdE„ZydFezfdG„ƒYZ{dHehj|fdI„ƒYZ}dJeHj~fdK„ƒYZdS(Ls|Handles all processes relating to instances (guest vms).

The :py:class:`ComputeManager` class is a :py:class:`nova.manager.Manager` that
handles RPC calls relating to creating instances.  It is responsible for
building a disk image, launching it via the underlying virtualization driver,
responding to calls to check its state, attaching persistent storage, and
terminating it.

iÿÿÿÿN(t
exceptions(tgreenthread(tlog(t	jsonutils(tloopingcall(t
periodic_task(texcutils(tstrutils(t	timeutils(trange(tblock_device(trpcapi(tpipelib(tcompute(t
build_results(tclaims(tpower_state(tresource_tracker(ttask_states(tutils(twrap_instance_event(t	vm_states(t	conductor(tconsoleauth(t	exception(texception_wrapper(thooks(t_(t_LE(t_LI(t_LW(timage(tglance(tmanager(tnetwork(tbase_api(tmodel(topenstack_driver(tobjects(tbase(tfields(tinstance(tmigrate_data(t	whitelist(trpc(t
safe_utils(tclient(tconfigdrive(tdriver(tevent(t
storage_users(tvirtapi(tcinder(t
encryptorstserviceR
tget_notifiertbinarysnova-computet	migrationcs"tjˆƒ‡fd†ƒ}|S(s,Decorator to error out migration on failure.c	
sýyˆ||||ŽSWnßtk
rø}tjƒ¾tjˆƒ}tj|||||Ž}|d}t|tj	ƒs˜|j
}|dkr˜dSnd|_
y!|jƒ|jƒWdQXWn*tk
rît
jd|jdtƒnXWdQXnXdS(NR9t	migratingspost-migratingterrors/Error setting migration status for instance %s.texc_info(s	migratingspost-migrating(t	ExceptionRtsave_and_reraise_exceptionR-tget_wrapped_functiontinspecttgetcallargst
isinstanceRtInstanceNotFoundtstatustobj_as_admintsavetLOGtdebugt
instance_uuidtTrue(	tselftcontexttargstkwargstextwrapped_funct
keyed_argsR9RD(tfunction(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdecorated_functionws&

		

	(t	functoolstwraps(RRRS((RRsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyterrors_out_migrationssR)cs"tjˆƒ‡fd†ƒ}|S(s*Decorator to revert task_state on failure.c

sDyˆ||||ŽSWn&tjk
r^}tjƒ!tjtdƒ|jƒƒWdQXnâtk
r?tjƒÃt	j
ˆƒ}tj|||||Ž}|d}|j
}y6|j||ddƒtjtdƒ|d|ƒWnHtjk
rn5tk
r5}tdƒ}	tj|	|d|ƒnXWdQXnXdS(NsTask possibly preempted: %sR)t
task_statesASuccessfully reverted task state from %s on failure for instance.s3Failed to revert task state for instance. Error: %s(RtUnexpectedTaskStateErrorRR>RGtinfoRtformat_messageR=R-R?R@RARWt_instance_updatetNoneRCRtwarning(
RKRLRMRNteRPRQR)toriginal_task_statetmsg(RR(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRSšs.



	(RTRU(RRRS((RRsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytreverts_task_state–s$cs"tjˆƒ‡fd†ƒ}|S(sÙWraps a method to catch exceptions related to instances.

    This decorator wraps a method to catch any exceptions having to do with
    an instance that may get thrown. It then logs an instance fault in the db.
    c	s yˆ||||ŽSWn‚tjk
r0‚nltk
r›}|jttˆjjd|ƒƒƒtj	ƒ%t
j||d|tj
ƒƒWdQXnXdS(NiR)(RRCR=tupdatetdicttzipt__code__tco_varnamesRR>t
compute_utilstadd_instance_fault_from_exctsysR<(RKRLRMRNR^(RR(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRSÉs&
	(RTRU(RRRS((RRsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytwrap_instance_faultÁstimage_idcs"tjˆƒ‡fd†ƒ}|S(suUsed for snapshot related method to ensure the image created in
    compute.api is deleted when an error occurs.
    cs«yˆ||||||ŽSWn‡tk
r¦tjƒhtjd|dtd|ƒy|jj||ƒWn-tk
rœtjt	dƒ|d|ƒnXWdQXnXdS(NsCleaning up image %sR<R)s'Error while trying to clean up image %s(
R=RR>RGRHRJt	image_apitdeleteRR(RKRLRkR)RMRN(RR(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRSãs



(RTRU(RRRS((RRsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdelete_image_on_errorÝscs"tjˆƒ‡fd†ƒ}|S(sˆWraps a method that expects a new-world instance

    This provides compatibility for callers passing old-style dict
    instances.
    cs¸‡fd†}y||dƒ|d<Wn,tk
rU||dƒf|d}nX|jdƒ}t|tƒr¥tjjˆjƒtjƒ|ƒ}||d<nˆ|ˆ||ŽS(Ncsit|tƒregdD]}||kr|^q}tjjˆtjƒ|d|ƒ}ˆ|_|S|S(Ntmetadatatsystem_metadatatexpected_attrs(smetadatassystem_metadata(RBRcR&tInstancet_from_db_objectt_context(tinstance_or_dicttmetatmetasR)(RL(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_load_instances
			R)iiR9(tKeyErrortgetRBRcR&t	MigrationRstelevated(RKRLRMRNRxR9(RR(RLsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRSs
		
(RTRU(RRRS((RRsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
object_compatüstInstanceEventscBsDeZd„Zed„ƒZd„Zd„Zd„Zd„ZRS(cCs
i|_dS(N(t_events(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt__init__%scCsd|jdfS(Ns%s-%stevents(tuuid(R)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
_lock_name(scsrˆjdkr!tjdƒ‚ntjˆjˆƒƒ‡‡‡fd†ƒ}tjdiˆd6dˆƒ|ƒS(sPrepare to receive an event for an instance.

        This will register an event for the given instance that we will
        wait on later. This should be called before initiating whatever
        action will trigger the event. The resulting eventlet.event.Event
        object should be wait()'d on to ensure completion.

        :param instance: the instance for which the event will be generated
        :param event_name: the name of the event we're expecting
        :returns: an event object that should be wait()'d on
        s+In shutdown, no new events can be scheduledcs1ˆjjˆjiƒ}|jˆtjjƒƒS(N(Rt
setdefaultR‚teventletR1tEvent(tinstance_events(t
event_nameR)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_create_or_get_event>s	s.Preparing to wait for external event %(event)sR1R)N(	RR\Rt
NovaExceptionRtsynchronizedRƒRGRH(RKR)RˆR‰((RˆR)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytprepare_for_instance_event,s-	csÕtƒ‰tƒ‰tjˆjˆƒƒ‡‡‡‡‡fd†ƒ}|ƒ}|ˆkr~tjdiˆjd6dˆƒdS|ˆkrÍtjdiˆjd6ˆjj	ˆj
iƒjƒd6dˆƒdS|SdS(sÚRemove a pending event from the wait list.

        This will remove a pending event from the wait list so that it
        can be used to signal the waiters to wake up.

        :param instance: the instance for which the event was generated
        :param event: the nova.objects.external_event.InstanceExternalEvent
                      that describes the event
        :returns: the eventlet.event.Event object on which the waiters
                  are blocked
        cs~ˆjs tjddˆƒˆSˆjjˆjƒ}|s?ˆS|jˆjdƒ}|sjˆjˆj=n|dkrzˆS|S(Ns0Unexpected attempt to pop events during shutdownR)(RRGRHRzR‚tpoptkeyR\(Rt_event(R1R)tno_events_sentineltno_matching_event_sentinelRK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
_pop_eventVs	s-No waiting events found dispatching %(event)sR1R)s)No event matching %(event)s in %(events)sRN(tobjectRR‹RƒRGRHRŽR\RRzR‚tkeys(RKR)R1R’tresult((R1R)RR‘RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytpop_instance_eventGs 		3			
"cs1tjˆjˆƒƒ‡‡fd†ƒ}|ƒS(s9Remove all pending events for an instance.

        This will remove all events currently pending for an instance
        and return them (indexed by event name).

        :param instance: the instance for which events should be purged
        :returns: a dictionary of {event_name: eventlet.event.Event}
        cs?ˆjdkr)tjddˆƒtƒSˆjjˆjiƒS(Ns2Unexpected attempt to clear events during shutdownR)(RR\RGRHRcRR‚((R)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
_clear_events~s
(RR‹Rƒ(RKR)R—((R)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytclear_events_for_instanceus	*c	
CsÝ|jdkr tjdƒdS|j}d|_x¤|jƒD]–\}}x‡|jƒD]y\}}tjdi|d6|d6ƒ|jddƒ\}}tjd|d|dd	d
|diƒ}|j|ƒqXWq?WdS(Ns4Unexpected attempt to cancel events during shutdown.sBCanceling in-flight event %(event)s for instance %(instance_uuid)sR1RIt-itnameRDtfailedttagtdata(	RR\RGRHtitemstrsplitR&tInstanceExternalEventtsend(	RKt
our_eventsRIRRˆteventlet_eventRšRœR1((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytcancel_all_events‡s 
			
	(	t__name__t
__module__R€tstaticmethodRƒRŒR–R˜R¤(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR~$s			.	tComputeVirtAPIcBs2eZd„Zd„Zejddd„ƒZRS(cCs tt|ƒjƒ||_dS(N(tsuperR¨R€t_compute(RKR
((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR€žscCstjtdƒƒ‚dS(NsInstance event failed(RRŠR(RKRˆR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_default_error_callback¢si,ccs+|dkr|j}ni}x‹|D]ƒ}t|tƒr^|\}}tjj||ƒ}ny |jjj	||ƒ||<Wq%t
jk
r§|||ƒd}q%Xq%WdVtj
j|ƒbxZ|jƒD]L\}}	|	jƒ}
|
jdkrþqÑn|||ƒ}|tkrÑPqÑqÑWWdQXdS(sËPlan to wait for some events, run some code, then wait.

        This context manager will first create plans to wait for the
        provided event_names, yield, and then wait for all the scheduled
        events to complete.

        Note that this uses an eventlet.timeout.Timeout to bound the
        operation, so callers should be prepared to catch that
        failure and handle that situation appropriately.

        If the event is not received by the specified timeout deadline,
        eventlet.timeout.Timeout is raised.

        If the event is received but did not have a 'completed'
        status, a NovaException is raised.  If an error_callback is
        provided, instead of raising an exception as detailed above
        for the failure case, the callback will be called with the
        event_name and instance, and can return True to continue
        waiting for the rest of the events, False to stop processing,
        or raise an exception which will bubble up to the waiter.

        :param instance: The instance for which an event is expected
        :param event_names: A list of event names. Each element can be a
                            string event name or tuple of strings to
                            indicate (name, tag).
        :param deadline: Maximum number of seconds we should wait for all
                         of the specified events to arrive.
        :param error_callback: A function to be called if an event arrives

        iNt	completed(R\R«RBttupleR&R tmake_keyRªR‡RŒRRŠR…ttimeouttTimeoutRžtwaitRDtFalse(RKR)tevent_namestdeadlineterror_callbackRRˆRšRœR1tactual_eventtdecision((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytwait_for_instance_event¥s."
	
N(R¥R¦R€R«t
contextlibtcontextmanagerR\R¸(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¨s
		tComputeManagercBs„eZdZejddƒZdZed„Zd„Z	d„Z
d„Zd„Zd	„Z
ed
„Zed„Zd„Zed
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Ze ƒd„ƒZ!e ƒd„ƒZ"e#e ƒd„ƒƒZ$d„Z%d„Z&d „Z'd!„Z(ed"„Z)e*j*d#„ƒZ+d$„Z,d%„Z-d&„Z.d'„Z/d(„Z0d)„Z1d*„Z2d+„Z3d,„Z4d-„Z5e6d.„Z7d/„Z8d0„Z9d1„Z:e*j*d2e;j<ƒd3„ƒZ=eeeed4„Z>ed5„Z?eed6„Z@e ƒeAeBeeeeeeed7„ƒƒƒZCd8„ZDeEjFd9ƒe ƒeAeGd:d;ƒeBeed<„ƒƒƒƒƒZHd=„ZId>„ZJeKjLd?„ƒZMd@„ZNedA„ZOdB„ZPe6dC„ZQee6e6dD„ZRe6dE„ZSeEjFdFƒdG„ƒZTe ƒeAeGd:d;ƒeBdH„ƒƒƒƒZUe ƒeAeGd:d;ƒeBdI„ƒƒƒƒZVdJ„ZWdK„ZXe ƒeAeGd:d;ƒeBdL„ƒƒƒƒZYejZe[e\j]e\j^ƒe ƒeGd:d;ƒeBdM„ƒƒƒƒZ_e ƒeAeGd:d;ƒeBdN„ƒƒƒƒZ`e ƒeAeGd:d;ƒeBdO„ƒƒƒƒZaebdP„ƒZceeeedQ„ZdejZe\jeƒe ƒeAeGd:d;ƒeBeeeeedR„ƒƒƒƒƒZfdS„ZgebdT„ƒZhdU„ZidV„Zje ƒeAeGd:d;ƒeBdW„ƒƒƒƒZkeldX„ƒZme ƒeAeBdY„ƒƒƒZne ƒeAeBeldZ„ƒƒƒƒZod[„Zpd\„ZqejZe[ƒe ƒd]„ƒƒZrejZe[ƒe ƒd^„ƒƒZseBd_„ƒZte ƒeAeGd:d;ƒeBd`„ƒƒƒƒZue ƒeAeBda„ƒƒƒZvedb„Zwe ƒeAeGd:d;ƒeBdc„ƒƒƒƒZxe ƒeAeGd:d;ƒeBdd„ƒƒƒƒZye ƒeBde„ƒƒZze ƒeGd:d;ƒeBdf„ƒƒƒZ{edg„Z|e ƒeAeGd:d;ƒe}eBdh„ƒƒƒƒƒZ~e ƒeAeGd:d;ƒe}eBdi„ƒƒƒƒƒZe6dj„Z€e ƒeAeGd:d;ƒeBdk„ƒƒƒƒZdl„Z‚e ƒeAeGd:d;ƒe}eBdm„ƒƒƒƒƒZƒdn„Z„ebdo„ƒZ…dp„Z†e ƒeAeGd:d;ƒe}eBdq„ƒƒƒƒƒZ‡e ƒeBdr„ƒƒZˆe ƒeBds„ƒƒZ‰e ƒeAeGd:d;ƒeBdt„ƒƒƒƒZŠe ƒeAeGd:d;ƒeBdu„ƒƒƒƒZ‹e ƒdv„ƒZŒe ƒdw„ƒZe ƒdx„ƒZŽe ƒdy„ƒZe ƒeBdz„ƒƒZe#e ƒeBd{„ƒƒƒZ‘e ƒeAeGd:d;ƒeBd|„ƒƒƒƒZ’e ƒeAeGd:d;ƒeBd}„ƒƒƒƒZ“e ƒeAeGd:d;ƒeBd~„ƒƒƒƒZ”d„Z•e ƒeAeBd€„ƒƒƒZ–d„Z—e ƒeAeGd:d;ƒeBd‚„ƒƒƒƒZ˜dƒ„Z™d„„Zšd…„Z›ejZe[ƒeBd†„ƒƒZœd‡„ZeBdˆ„ƒZžejZe[e\jŸe\j ƒe ƒeBd‰„ƒƒƒZ¡dŠ„Z¢ejZe\j£e\j¤e\j e\j¥e[ƒe ƒeBd‹„ƒƒƒZ¦ejZe\j£e\j¤e\j e\j¥e[ƒe ƒeBdŒ„ƒƒƒZ§ejZe\j£e\j¤e\j e\j¥e[ƒe ƒeBd„ƒƒƒZ¨ejZe\j£e\j¤e\j e\j¥e[ƒe ƒeBdŽ„ƒƒƒZ©ejZe\j£e\j¤e\j e\j¥e\jªe\j«e\j¬e[ƒe ƒeBd„ƒƒƒZ­ejZe\j£e\j¤e\j ƒe ƒeBd„ƒƒƒZ®e ƒeAeBd‘„ƒƒƒZ¯e ƒeBd’„ƒƒZ°d“„Z±d”„Z²e6ed•„Z³e ƒeBed–„ƒƒZ´d—„Zµd˜„Z¶e ƒeAeBd™„ƒƒƒZ·e ƒdš„ƒZ¸e ƒeBd›„ƒƒZ¹e ƒeBdœ„ƒƒZºd„Z»e ƒdž„ƒZ¼e ƒeGd:d;ƒeBdŸ„ƒƒƒZ½d „Z¾e ƒeGd:d;ƒeBd¡„ƒƒƒZ¿e ƒeGd:d;ƒeBd¢„ƒƒƒZÀd£„ZÁe ƒeGd:d;ƒeBd¤„ƒƒƒZÂe ƒeGd:d;ƒeBed¥„ƒƒƒZÃe ƒeGd:d;ƒeBd¦„ƒƒƒZÄd§„ZÅe ƒeBeed¨„ƒƒZÆd©„ZÇdª„ZÈe ƒeGd:d;ƒeBd«„ƒƒƒZÉe ƒeBed¬d­„ƒƒZÊe ƒeGd:d;ƒeBd®„ƒƒƒZËe*j*d2e;j̃d¯„ƒZÍe*j*d°„ƒZÎe*j*d±„ƒZÏe*j*d²„ƒZÐe*j*d2e;jуd³„ƒZÒe*j*d´„ƒZÓe*j*d2e;jԃdµ„ƒZÕed¶„ZÖd·„Z×e*j*d2e;j؃d¸„ƒZÙe*j*d2e;jÚd¹e6ƒdº„ƒZÛd»„ZÜed¼„ZÝe*j*d½„ƒZÞd¾„Zße*j*d2e;jàƒd¿„ƒZáedÀ„Zâe*j*d2e;jãƒdÁ„ƒZäd„ZådÄZæeKjLeeçjèdĄƒZée ƒdńƒZêe ƒdƄƒZëdDŽZìdȄZíe ƒdɄƒZîe*j*d2e;jïdÊe6ƒd˄ƒZðe*j*d2e;jñƒd̄ƒZòe*j*d2e;jñƒd̈́ƒZóejZe\jôe\jõe\jöe[ƒe ƒd΄ƒƒZ÷dτZøejZe\jôe\jõe\jöe[ƒe ƒedЄƒƒZùRS(Ñs;Manages the running instances from creation to destruction.tversions4.13i
cOsât|ƒ|_tjƒ|_tjƒ|_tjƒ|_d|_	d|_
t|_d|_
tjƒ|_tjƒ|_tjƒ|_tjƒ|_tjƒ|_tjjƒ|_tjƒ|_tjƒ|_i|_ t!ƒ|_"t#j$dt%j&ƒ|_'i|_(t%j)|_*t%j+dkrGt#j,j-t%j+ƒ|_.nt/j0ƒ|_.t1t%j2dƒdkr‰t#j,j-t%j2ƒ|_3nt/j0ƒ|_3t4t5|ƒj6dd||Žt7j8|j|ƒ|_7|j7j9|_:dS(s9Load configuration options and connect to the hypervisor.itsizetservice_nameR
N(;R¨R3R"tAPItnetwork_apiR4t
volume_apiRRlt_last_host_checkt_last_bw_usage_pollRJt_bw_usage_supportedt_last_bw_usage_cell_updateR
tcompute_apitcompute_rpcapit
ComputeAPIRt
conductor_apitComputeTaskAPItcompute_task_apiR%tis_neutron_security_groupsRRtConsoleAuthAPItconsoleauth_rpcapitcells_rpcapitCellsAPItscheduler_clienttSchedulerClientt_resource_tracker_dictR~R‡R…t	GreenPooltCONFtsync_power_state_pool_sizet_sync_power_poolt_syncs_in_progresst!scheduler_tracks_instance_changestsend_instance_updatestmax_concurrent_buildst	semaphoret	Semaphoret_build_semaphoreRgtUnlimitedSemaphoretmaxtmax_concurrent_live_migrationst_live_migration_semaphoreR©R»R€R0tload_compute_drivertneed_legacy_block_device_infotuse_legacy_block_device_info(RKtcompute_driverRMRN((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR€îsD									
cCs/tjtdƒƒdt_tjƒ|_dS(NsReloading compute RPC API(RGRYRR\RÇtLAST_VERSIONRÈ(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytresets	cCsu|jj|ƒ}|sq|jj|ƒsFtjtdƒ|ƒ‚ntj|j	|j|ƒ}||j|<n|S(Ns4%s is not a valid node managed by this compute host.(
RÓRzR0tnode_is_availableRRŠRRtResourceTrackerthost(RKtnodenametrt((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_resource_tracker!s	
	cCsP|j|jkrL|jj|jƒrL|j|jƒ}|j||ƒndS(sALet the resource tracker know that an instance has changed state.N(RëR0RétnodeRîtupdate_usage(RKRLR)Rí((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_update_resource_tracker/scKsKx*|jƒD]\}}t|||ƒq
W|jƒ|j||ƒdS(s9Update an instance in the database using kwargs as value.N(RžtsetattrRFRñ(RKRLR)RNtktv((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR[7s
cCsd|_d|_dS(N(R\RëRï(RKR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt#_nil_out_instance_obj_host_and_node?s	cCsZy,tj|_|r!d|_n|jƒWn'tjk
rUtj	dd|ƒnXdS(NsIInstance has been destroyed from under us while trying to set it to ERRORR)(
RtERRORtvm_stateR\RWRFRRCRGRH(RKRLR)tclean_task_state((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_set_instance_obj_error_stateGsc
Csø|si}nyX|jjƒ}t|ƒdkr=tjƒS||d<tjj||dtƒ}|SWntk
rznX|jjƒ}tjj||dtƒ}d„|Dƒ}g}x6|D].}|j	|ƒ}	|	sãqÂn|j
|	ƒqÂW|S(sòReturn a list of instance records for the instances found
        on the hypervisor which satisfy the specified filters. If filters=None
        return a list of instance records for all the instances found on the
        hypervisor.
        iR‚t	use_slavecSsi|]}||j“qS((Rš(t.0R)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pys
<dictcomp>ks	(R0tlist_instance_uuidstlenR&tInstanceListtget_by_filtersRJtNotImplementedErrortlist_instancesRztappend(
RKRLtfilterstdriver_uuidstlocal_instancestdriver_instancest	instancestname_maptdriver_instanceR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_instances_on_driverRs.	

	
	
cCsŠi|jd6ddgd6dd6}tjj||ƒ}|sCdSd„|Dƒ}itd	6}|j||ƒ}g|D]}|j|kry|^qy}xé|D]á}||j}tjt	d
ƒd|ƒy>|j
j||ƒ}	|j||ƒ}
|j
||ƒ}WnEtjk
rRtjƒ}	i}
tjt	dƒd|ƒt}nX|jj|||	|
|ƒd
|_|jƒq¡WdS(s¶Destroys evacuated instances.

        While nova-compute was down, the instances running on it could be
        evacuated to another host. Check that the instances reported
        by the driver are still associated with this host.  If they are
        not, destroy them, with the exception of instances which are in
        the MIGRATING, RESIZE_MIGRATING, RESIZE_MIGRATED, RESIZE_FINISH
        task state or RESIZED vm state.
        tsource_computetacceptedtdoneRDt
evacuationtmigration_typeNcSsi|]}||j“qS((RI(Rûtmig((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pys
<dictcomp>†s	tdeleteds9Deleting instance as it has been evacuated from this hostR)sJInstance has been marked deleted already, removing it from the hypervisor.R¬(RëR&t
MigrationListRÿR²R
R‚RGRYRRÀtget_instance_nw_infot_get_instance_block_device_infot_is_instance_storage_sharedRRCt
network_modeltNetworkInfoRJR0tdestroyRDRF(RKRLRtevacuationsRtinstt	evacuatedR)R9tnetwork_infotbdit
destroy_disks((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_destroy_evacuated_instancestsD







			

	cCsÊt}d}zšy@|jj||ƒ}|rN|jj|||d|ƒ}nWnStk
r{tjdd|ƒt	}n*t
k
r¤tjtdƒd|ƒnXWd|rÅ|jj
||ƒnX|S(NRëseHypervisor driver does not support instance shared storage check, assuming it's not on shared storageR)s"Failed to check if instance shared(RJR\R0t#check_instance_shared_storage_localRÇtcheck_instance_shared_storageRRGRHR²R=RRt%check_instance_shared_storage_cleanup(RKRLR)Rëtshared_storageR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¥s*		
	
cCs«|j}|jƒtjj||jƒ}tjd|ƒ}tjj||ƒ\}}|j	d|d|ddd|j
jd|j
jƒ|j
|||||ƒdS(	sfComplete deletion for instances in DELETED status but not marked as
        deleted in the DB
        RLt
project_idtuser_idRiÿÿÿÿtcorestramN(RpRR&tBlockDeviceMappingListtget_by_instance_uuidR‚tQuotastquotastids_from_instancetreservetflavortvcpust	memory_mbt_complete_deletion(RKRLR)tsystem_metatbdmsR+R$R%((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_complete_partial_deletion¾s	
	
	cCs¬|r|jƒnx|D]}|jƒqW|j||ƒ|j||dd|ƒtj|||jdtjj	dtj
jƒ|j||ƒ|j
||jƒdS(Ns
delete.endRptactiontphase(tcommitRRñt_notify_about_instance_usageRgtnotify_about_instance_actionRëR(tNotificationActiontDELETEtNotificationPhasetENDt_clean_instance_console_tokenst_delete_scheduler_instance_infoR‚(RKRLR)R3R+R2tbdm((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR1Òs


cCsX|jj}|jj}tjd|ƒ}|jd|d|ddd|d|ƒ|S(NRLR$R%RiÿÿÿÿR&R'(R.R/R0R&R*R-(RKRLR)R$R%R/tmem_mbR+((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_create_reservationsäscCsŸ	|j|jkr@tjtdƒi|jd6|jd6ƒdS|jtjks|jtjkrœ|j	t
jt
jfkrœtj
d|jd|ƒdS|jtjkrùy|j||ƒWn0tk
rôtdƒ}tj|d|ƒnXdS|jtjks2|j	t
jt
jt
jt
jgkrhtj
dd|ƒd|_	tj|_|jƒdS|jtjtjgkrÚ|j	t
jt
jt
jgkrÚtj
d	d|ƒd|_	tj|_|jƒdS|jtjkr‰|j	t
jt
j t
j!t
j"gkr‰tj
d
|j	d|ƒy|j#||ƒWn0tk
rrtdƒ}tj|d|ƒnXd|_	|jƒn|jtjkrà|j	t
j$gkràtj
d
|dd|ƒd|_	|jƒn|j	t
jkrÑy˜tj%t&d
ƒd|ƒ|j'dƒ|j'dƒt(j)j*||jƒ}t(j+j,||ƒ\}}|j-||||ƒ}|j.||||ƒWn@tk
rÌtdƒ}tj|d|ƒ|j/||ƒnXdS|j0||ƒ}|j1|||ƒ\}	}
|	r—tj
di|j	d6|d6d|ƒt
j2t
j3t
j4g}|j	|krw|
dkrwt
j5|_	|jƒn|j6||ddd|
ƒdS|t7j8kr|j	t
j2t
j9t
j:t
j;gkrtjtdƒi|j	d6|d6d|ƒd|_	tj|_|jƒn£|t7j<kr¿|j	t
j;kr¿tjtdƒi|j	d6|d6d|ƒy|j=||ƒWn:t>k
r‘n*tk
rºtjtdƒd|ƒnXdS|j	t
j?kr8y0tj
d|j	d|ƒ|j@||tAƒWn0tk
r3tdƒ}tj|d|ƒnXdS|j	t
jBkr®y-tj
d|j	d|ƒ|jC||ƒWn0tk
r©tdƒ}tj|d|ƒnXdStDjE|ƒ}y|jFjG||ƒWnct>k
rü}
tj
|
d|ƒn>tjHk
r9tjtdƒd|ƒ|j/||ƒdSX|j	t
jkrýz~yM|jIjJdƒtjk}|jK||ƒ}|jFjL|||||ƒWn*tk
rÈtjtdƒd|ƒnXWdtj%t&dƒd|ƒd|_	|jƒXn|j	t
jMkr1d|_	|jd t
jMgƒn|j7}|j0||ƒ}|t7j8kod||k}tj
d!i|d"6|d#6d|ƒ|rK	tNjOrK	tj%t&d$ƒd|ƒ|jK||ƒ}y|jFjP||||ƒWq›	t>k
r	tjtd%ƒd|ƒq›	tk
rG	tjtd&ƒd|ƒ|j/||ƒq›	XnP|t7j8kr›	y|jFjQ||ƒWq›	t>k
r—	tj
d'd|ƒq›	XndS((s-Initialize this instance during service init.smInstance %(uuid)s appears to not be owned by this host, but by %(host)s. Startup processing is being skipped.R‚RëNsInstance is in %s state.R)sFailed to complete a deletions:Instance failed to spawn correctly, setting to ERROR states<Instance failed to rebuild correctly, setting to ERROR statesAInstance in transitional state %s at start-up clearing task statesFailed to cleanup snapshot.RWsoService started deleting the instance during the previous run, but did not finish. Restarting the deletion now.RoRpssInstance in transitional state (%(task_state)s) at start-up and power state is (%(power_state)s), triggering rebootRtHARDtblock_device_infotreboot_typesuInstance in transitional state (%(task_state)s) at start-up and power state is (%(power_state)s), clearing task statesInstance in transitional state (%(task_state)s) at start-up and power state is (%(power_state)s), clearing task state and unpausing the instancesFailed to unpause instancesCInstance in transitional state %s at start-up retrying stop requestsFailed to stop instancesDInstance in transitional state %s at start-up retrying start requestsFailed to start instancesVifs plug failedtold_vm_states"Failed to revert crashed migrationsFInstance found in migrating state during startup. Resetting task_statetexpected_task_states<Current state is %(drv_state)s, state in DB is %(db_state)s.t	drv_statetdb_states.Rebooting instance after nova-compute restart.s0Hypervisor driver does not support resume guestssFailed to resume instances1Hypervisor driver does not support firewall rules(RRëRGR]RR‚R÷RtSOFT_DELETEDRöRWRtRESIZE_MIGRATINGtDELETINGRHtDELETEDR4R=RRtBUILDINGt
SCHEDULINGtBLOCK_DEVICE_MAPPINGt
NETWORKINGtSPAWNINGR\RFtACTIVEtSTOPPEDt
REBUILDINGtREBUILD_BLOCK_DEVICE_MAPPINGtREBUILD_SPAWNINGtIMAGE_SNAPSHOT_PENDINGtIMAGE_PENDING_UPLOADtIMAGE_UPLOADINGtIMAGE_SNAPSHOTt"_post_interrupted_snapshot_cleanuptRESIZE_PREPRYRt
obj_load_attrR&R(R)R+R,RBt_delete_instanceRùt_get_power_statet
_retry_reboottREBOOT_STARTEDtREBOOT_PENDINGt	REBOOTINGtREBOOT_PENDING_HARDtreboot_instanceRtRUNNINGtREBOOT_STARTED_HARDtPAUSINGt	UNPAUSINGtPAUSEDtunpause_instanceRtPOWERING_OFFt
stop_instanceRJtPOWERING_ONtstart_instanceRgtget_nw_info_for_instanceR0t	plug_vifstVirtualInterfacePlugExceptionRpRzRtfinish_revert_migrationt	MIGRATINGRÕt resume_guests_state_on_host_boottresume_state_on_host_boott#ensure_filtering_rules_for_instance(RKRLR)R`R3R$R%R+tcurrent_power_statet
try_rebootREt
soft_typestnet_infoR^tpower_ontblock_dev_infoRIRHtexpect_runningRD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_init_instanceðs†	
	
	
	
	
	
		


		
	




	




	
	
		
					


	
c
Cs¯|j}t}tj||ƒ}|tjko?|jtjk}|tj	ko`|jtj
k}|tjtjgko‡|t
jk}	|sœ|sœ|	r¥t}n||fS(N(RWR²Rgtget_reboot_typeRRcR÷RtALLOW_SOFT_REBOOTRetALLOW_HARD_REBOOTRbRhRRgRJ(
RKRLR)Rytcurrent_task_statetretry_rebootREtpending_softtpending_hardtstarted_not_running((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRas				cCs¯tjtdƒi|jƒd6d|jƒƒtjjddƒ}tj	j
||jƒdgƒ}d}|jƒt
jkrŒtj}n |jƒt
jkr­tj}n|jƒt
jkrÎtj}n^|jƒt
jkrïtj}n=|jƒt
jkrtj}ntjtdƒ|jƒƒ|j||ƒ}||kr«tjdi|jƒd	6|jd
6|jd6|jd6|d
6d|jƒ|j|||ƒndS(NsVM %(state)s (Lifecycle Event)tstateRItread_deletedtyesRqsUnexpected power state %dsØSynchronizing instance power state after lifecycle event "%(event)s"; current vm_state: %(vm_state)s, current task_state: %(task_state)s, current DB power_state: %(db_power_state)s, VM power_state: %(vm_power_state)sR1R÷RWtdb_power_statetvm_power_state( RGRYRtget_nametget_instance_uuidtnovaRLtget_admin_contextR&Rrtget_by_uuidR\tget_transitiont	virteventtEVENT_LIFECYCLE_STOPPEDRtSHUTDOWNtEVENT_LIFECYCLE_STARTEDRgtEVENT_LIFECYCLE_PAUSEDRktEVENT_LIFECYCLE_RESUMEDtEVENT_LIFECYCLE_SUSPENDEDt	SUSPENDEDR]RR`RHR÷RWR‚t_sync_instance_power_state(RKR1RLR)RRy((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pythandle_lifecycle_events@
	
	




	cCsat|tjƒrMy|j|ƒWq]tjk
rItjd|ƒq]Xntjd|ƒdS(NsNEvent %s arrived for non-existent instance. The instance was probably deleted.sIgnoring event %s(RBR”tLifecycleEventRRRCRGRH(RKR1((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
handle_eventsEs	cCs^tjjr"|jj|jƒn8tjdkrGtjt	dƒƒntj
tdƒƒdS(NisóInstance lifecycle events from the compute driver have been disabled. Note that lifecycle changes to an instance outside of the compute service will not be synchronized automatically since the _sync_power_states periodic task is also disabled.sÒInstance lifecycle events from the compute driver have been disabled. Note that lifecycle changes to an instance outside of the compute service will only be synchronized by the _sync_power_states periodic task.(RÕtworkaroundsthandle_virt_lifecycle_eventsR0tregister_event_listenerRŸtsync_power_state_intervalRGR]RRYR(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytinit_virt_eventsOs
cCsëtjrtjtjƒn|jjd|jƒtjj	ƒ}t
jj||jdddgƒ}tj
r~|jjƒn|jƒz2|j|ƒx|D]}|j||ƒqŸWWdtj
rÖ|jjƒn|j||ƒXdS(s0Initialization for a standalone compute service.RëRqt
info_cacheRoN(RÕtpci_passthrough_whitelistR+t	WhitelistR0t	init_hostRëRRLR‘R&Rþtget_by_hosttdefer_iptables_applytfilter_defer_apply_onR¤RR€tfilter_defer_apply_offt_update_scheduler_instance_info(RKRLRR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¨cs 			


	cCs7|jjdƒ|jjƒ|jjd|jƒdS(NRë(R0R¢R\R‡R¤tcleanup_hostRë(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR®„s
cCs|jtjjƒƒdS(sÑAfter the service is initialized, but before we fully bring
        the service up by listening on RPC queues, make sure to update
        our available resources (and indirectly our available nodes).
        N(tupdate_available_resourceRRLR‘(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytpre_start_hook‰scCsItjdd|ƒy|jj|ƒjSWntjk
rDtjSXdS(s0Retrieve the power state for the given instance.sChecking stateR)N(	RGRHR0tget_infoR‰RRCRtNOSTATE(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR`s
cCsdtjtjfS(sˆRetrieves the console host for a project on this host.

        Currently this is just set in the flags for each compute host.

        s%s.%s(RÕt
console_topictconsole_host(RKRL((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytget_console_topic˜scCs|jj|ƒS(N(R0tget_console_pool_info(RKRLtconsole_type((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¶¡scCs|jj|ƒS(sˆTell the virtualization driver to refresh security group rules.

        Passes straight through to the virtualization driver.

        (R0trefresh_security_group_rules(RKRLtsecurity_group_id((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¸§scs+tjˆjƒ‡‡fd†ƒ}|ƒS(sÿTell the virtualization driver to refresh security rules for
        an instance.

        Passes straight through to the virtualization driver.

        Synchronize the call because we may still be in the middle of
        creating the instance.
        cs?yˆjjˆƒSWn$tk
r:tjddˆƒnXdS(Ns3Hypervisor driver does not support security groups.R)(R0trefresh_instance_security_rulesRRGRH((R)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
_sync_refresh¼s

(RR‹R‚(RKRLR)R»((R)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRº±s$c		Cs)tjƒ}tj}|dkrAtjtdƒi|d6ƒnd}|dkr`|d}nxŽtd|dƒD]y}|jj||ƒ}|d}|dkrÝ|dkrµ|Stjtd	ƒi|d
6|d6ƒPnt	j
tjƒqtWtj
d|d
ttjƒ|ƒd|d|ƒ‚dS(NisMTreating negative config value (%(retries)s) for 'block_device_retries' as 0.tretriesiRDtcreatingtdownloadingt	availablesNVolume id: %(vol_id)s finished being created but its status is %(vol_status)s.tvol_idt
vol_statust	volume_idtsecondstattemptst
volume_status(R½R¾(ttimeRÕtblock_device_allocate_retriesRGR]RR	RÁRzRtsleept&block_device_allocate_retries_intervalRtVolumeNotCreatedtint(	RKRLRÀtstartR¼RÄtattempttvolumeRÅ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_await_block_device_map_createdÆs.	


cCs0|s
gSd„}g|D]}||ƒ^qS(s*Base64 decode the list of files to inject.cSs\|\}}ytj|ƒ}||fSWn,ttjfk
rWtjd|ƒ‚nXdS(Ntpath(tbase64t	b64decodet	TypeErrortbinasciitErrorRtBase64Exception(tfRÐtcontentstdecoded((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_decodeís((RKtinjected_filesRÚR×((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
_decode_filesès		cs`|jdƒpi}|jdƒ}|s.dStj|ƒ‡fd†ƒ}||||ƒdS(Ntscheduler_hintstgroupcsåtjj||ƒ}d|jkrx|jd|jgƒ}ˆj|krátdƒ}tj	d|jd|ƒ‚qánid|jkrá|jd|jgƒ}|ráˆj|krátdƒ}tj	d|jd|ƒ‚qándS(Ns
anti-affinitytexcludes1Anti-affinity instance group policy was violated.RItreasontaffinitys,Affinity instance group policy was violated.(
R&t
InstanceGrouptget_by_hinttpoliciest	get_hostsR‚RëRRtRescheduledException(RLR)t
group_hintRÞtgroup_hostsR`(RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_do_validations				(RzRR‹(RKRLR)tfilter_propertiesRÝRçRé((RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_validate_instance_group_policyøscCs*tjtdƒ|dd|d|ƒdS(Ns	Error: %siRIR<(RGR;R(RKR<RI((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_log_original_errorsc	CsË|j}	|jdƒ}
|
s5tjdd|	ƒdS|sRtjdd|	ƒdStjdi|jd6|
dd	6d|	ƒ|j||d
|ƒ|rºtj|d|dƒ|
d
<n|||ŒtS(s+Attempt to re-schedule a compute operation.tretrys+Retry info not present, will not rescheduleRINs$No request spec, will not reschedules)Re-scheduling %(method)s: attempt %(num)dtmethodtnum_attemptstnumRWiitexc(	R‚RzRGRHR¥R[t	tracebacktformat_exception_onlyRJ(RKRLtrequest_specRêR)treschedule_methodtmethod_argsRWR<RIRí((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_reschedule!s&		


cCsªtj}|dkrdSitjd6|jd6}tjj||dgdtƒ}xO|D]G}t	j
|j|ƒr[|j||ƒt
jtdƒd|ƒq[q[WdS(	s-Ensure that instances are not stuck in build.iNR÷RëRqRús-Instance build timed out. Set to error state.R)(RÕtinstance_build_timeoutRRNRëR&RþRÿRJRt
is_older_thant
created_atRùRGR]R(RKRLR¯Rtbuilding_instsR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_check_instance_build_timeBs	


cCs.|jj|ƒr*tjd|jƒ‚ndS(s=Ensure an instance with the same name is not already present.RšN(R0tinstance_existsRtInstanceExistsRš(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_check_instance_existsUscCs¤|r/|jr/tjdd|ƒtjgƒStjdd|ƒtj}|d}	d}
|jj||ƒ}x-t	d|	dƒD]}yd|j
j||d|d|d|d|d	|d
|ƒ}
tjd|
d|ƒd|jd
<|
SWq„t
k
r›tjƒ}i|d6|	d6}||	krPtjtdƒ|ƒtj|Œntjtdƒ|d|ƒtj|
ƒ|
d9}
|
dkrœd}
qœq„Xq„WdS(s]Method used to allocate networks in the background.

        Broken out for testing.
        s5Not allocating networking since 'none' was specified.R)s,Allocating IP information in the background.itvpntrequested_networkstmacstsecurity_groupstdhcp_optionstbind_host_idsInstance network_info: |%s|RJtnetwork_allocatedRÍRÄs;Instance failed network setup after %(attempts)d attempt(s)sCInstance failed network setup (attempt %(attempt)d of %(attempts)d)iiN(tno_allocateRGRHRRRÕtnetwork_allocate_retriesR0tnetwork_binding_host_idR	RÀtallocate_for_instanceRpR=RiR<RRtsixtreraiseR]RRÆRÈ(RKRLR)RRRtis_vpnRR¼RÄt
retry_timeRRÍtnwinfoR<tlog_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_allocate_network_asyncZsJ
	
		






cCs¢tj|jjddƒƒrJ|jj|||jƒ|jj||ƒS|js\g}n|j	j
|ƒ}|j	j|ƒ}|j||||||ƒ}|S(NRR²(
Rtbool_from_stringRpRzRÀtsetup_instance_network_on_hostRëRRÌR0tmacs_for_instancetdhcp_options_for_instancet_allocate_network(RKRLR)RRRRR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_build_networks_for_instances			c	Csrtj|_tj|_|jddgƒ|j||ƒt	j
|jƒ}tj
|j|||||||ƒS(sÅStart network allocation asynchronously.  Return an instance
        of NetworkInfoAsyncWrapper that can be used to retrieve the
        allocated networks when the operation has finished.
        RGN(RRNR÷RRQRWRFR\RñRtis_vpn_imaget	image_refRtNetworkInfoAsyncWrapperR(RKRLR)RRRRR
((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¨s	cCs?y|jj|||ƒSWntk
r:tj|gƒSXdS(N(R0tdefault_root_device_nameRRgtget_next_device_name(RKR)t
image_metatroot_bdm((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_default_root_device_name¼s
cGsEy|jj|||ŒWn$tk
r@tj|||ŒnXdS(N(R0t!default_device_names_for_instanceRRg(RKR)troot_device_nametblock_device_lists((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt"_default_device_names_for_instanceÄs
cCsW|jƒ}y|jj|||ƒSWn*tk
rRtj|||jdƒƒSXdS(Ntdevice_name(t	obj_cloneR0tget_device_name_for_instanceRRgRz(RKR)R3tblock_device_obj((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_device_name_for_instanceÏs	
c
Cstj|ƒ}|sdSd}t}|jrC|j}||_nQ|jrg|j}||_t}n-|j|||ƒ}||_||_t}|r§|jƒnt	t
tj|ƒƒ}t	t
tj|ƒƒ}t	t
t
j|ƒƒ}	|j|||||	ƒdS(sòVerify that all the devices have the device_name set. If not,
        provide a default name.

        It also ensures that there is a root_device_name and is set to the
        first block device in the boot sequence (boot_index=0).
        N(R
tget_root_bdmR\R²R$R!RJRRFtlisttfiltertnew_format_is_ephemeraltnew_format_is_swaptdriver_block_devicetis_block_device_mappingR#(
RKR)Rt
block_devicesRR!tupdate_root_bdmt
ephemeralstswaptblock_device_mapping((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_default_block_device_namesÙs>										
	cCs|jr}tjtj|ƒƒ}tjtj|ƒƒ}|d}|rX|jƒ}n|ji|d6|d6|d6ƒndS(s7Convert BDI to the old format for drivers that need it.R3R2R4N(RåR.tlegacy_block_devicesR0t block_device_info_get_ephemeralstblock_device_info_get_mappingtlegacyRb(RKRDR2tmappingR3((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_block_device_info_to_legacys	
	cCscx\|D]T}|jdk	r"qn|j|||ƒ}i|d6}|j|ƒ|jƒqWdS(NR$(R$R\R(RbRF(RKR3R)R@R$tvalues((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_add_missing_dev_namess
	

c
Csïyt|j||ƒtj||ƒ}tj|ƒ}tj||||j|jd|d|jƒ|j|ƒ|SWntt	j
k
rµtdƒ}tj
|d|ƒt	jƒ‚n6tk
rêtj	tdƒd|ƒt	jƒ‚nXdS(s;Set up the block device for an instance with error logging.tdo_check_attacht	wait_funcsRFailed to create block device for instance due to being over volume resource quotaR)s"Instance failed block device setupN(R=R0tget_block_device_infoR8R.tattach_block_devicesRÁRÏR;Rt	OverQuotaRRGR]tVolumeLimitExceededR=Rt
InvalidBDM(RKRLR)R3R>RDR:R`((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_prep_block_device$s$


cCsJ|j||ƒ|_tj|_d|_tjƒ|_	t
j|ƒdS(N(R`RRRSR÷R\RWRtutcnowtlaunched_atR/tupdate_instance(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_update_instance_after_spawn>s
	cCs`|js
dSt|tjƒr7tjd|gƒ}n|jƒ}|jj||j	|ƒdS(ssSends an InstanceList with created or updated Instance objects to
        the Scheduler client.

        In the case of init_host, the value passed will already be an
        InstanceList. Other calls will send individual Instance objects that
        have been created or resized. In this case, we create an InstanceList
        object containing that Instance.
        NR&(
RÚRBtobj_instanceRrR&RþR|RÑtupdate_instance_infoRë(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR­Es		cCs6|js
dS|jƒ}|jj||j|ƒdS(s?Sends the uuid of the deleted Instance to the Scheduler client.N(RÚR|RÑtdelete_instance_infoRë(RKRLRI((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR?Vs
	tspacingcCsv|js
dS|jƒ}tjj||jdgdtƒ}g|D]}|j^qD}|jj	||j|ƒdS(NRqRú(
RÚR|R&RþR©RëRJR‚RÑtsync_instance_info(RKRLRR)tuuids((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_sync_scheduler_instance_info^s		c
Cs5tj|j|||d|d|d|d|ƒdS(NRRptextra_usage_infotfault(Rgtnotify_about_instance_usagetnotifier(RKRLR)tevent_suffixRRpRQRR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR8is
c
Cs|r&|jr&tjdd|ƒdStjdd|ƒtjƒ }|jj||d|ƒWdQXtjtdƒ|j	ƒd|ƒdS(NsNSkipping network deallocation for instance since networking was not requested.R)s!Deallocating network for instanceRs6Took %0.2f seconds to deallocate network for instance.(
RRGRHRt	StopWatchRÀtdeallocate_for_instanceRYRtelapsed(RKRLR)Rttimer((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_deallocate_networkrs	cCsª|s!tjj||jƒ}ntj||ƒ}|sqgtj|ƒD]}|jdƒrI|^qI|d<n(tj	tj|ƒ|||j
|jƒ|j|ƒ|S(s:Transform block devices to the driver block_device format.tconnection_infoR4(R&R(R)R‚R0R@R8RzR.trefresh_conn_infosRÁR;(RKRLR)trefresh_conn_infoR3RDR@((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRƒs		
"
c
sVtj|jƒ‡fd†ƒ}
tj|
|||||||||	|
||ƒ
dS(Ncs$ˆjˆj||ŽWdQXdS(N(RÞt_do_build_and_run_instance(RMRN(RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt!_locked_do_build_and_run_instance¦s
(RR‹R‚tspawn_n(RKRLR)RRôRêtadmin_passwordRÛRRR4RïtlimitsR_((RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytbuild_and_run_instances	!		cCs½t}|rEx6|D]+}d|kr|jdk	rt}PqqWn|r‹|r‹x6|D]+}d|krY|jdk	rYt}PqYqYWn|r¹|jjjdƒr¹tjdƒ‚ndS(NRœtsupports_device_taggingsPAttempt to boot guest with tagged devices on host that does not support tagging.(	R²RœR\RJR0tcapabilitiesRzRtBuildAbortException(RKRR4ttagging_requestedtnetR@((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_check_device_tagging¸s


tbuild_instancetprefixR
c
CsŸyKtjdd|d|ƒtj|_d|_|jdtj	dfƒWnct
jk
r~d}
tj|
d|ƒtj
St
jk
r°}tj|jƒd|ƒtj
SX|j|ƒ}|dkrÕi}n|dkr|jjdtƒd}tjd|d|ƒnymtjƒ2}|j|||||||	|
|||ƒWdQXtjtd	ƒ|jƒd|ƒtjSWnt
jk
r}|jd
ƒ}|s#tjdd|ƒ|j|||ƒtj|||t j!ƒd|j"d
ƒ|j#|ƒ|j$||dtƒtj
Stj|jƒd|ƒt%j&t j!ƒŒ|d<|j"d
|d<|jj'|ƒs‡|j(|ƒr|j|||ƒn|j)j*|||j+ƒ|j#|ƒtj	|_|jƒ|j,j-||g||||||	|
ƒ	tj.St
jt
j/fk
rWd}
tj|
d|ƒ|j|||ƒtj
St
j0k
r÷}tj
|jƒd|ƒ|j|||ƒ|j1||j2|
dt3ƒtj|||t j!ƒƒ|j#|ƒ|j$||dtƒtj
St4k
rš}t5dƒ}
tj
|
d|ƒ|j|||ƒ|j1||j2|
dt3ƒtj|||t j!ƒƒ|j#|ƒ|j$||dtƒtj
SXdS(NsStarting instance...RLR)RGs"Instance disappeared before build.trefreshis#No node specified, defaulting to %ss%Took %0.2f seconds to build instance.Rís+Retry info not present, will not reschedulet
fault_messageRàRøRñt
exc_reasons"Instance disappeared during build.t	raise_excs1Unexpected build failure, not rescheduling build.(6RGRHRRNR÷R\RWRFRRORRCRtFAILEDRXRZRÜR0tget_available_nodesRJRRVt_build_and_run_instanceRYRRXRSRæRzt_cleanup_allocated_networksRgRhRiR<RNRõRùRòtformat_exceptiont!deallocate_networks_on_reschedulet$deallocate_sriov_ports_on_rescheduleRÀt cleanup_instance_network_on_hostRëRËtbuild_instancestRESCHEDULEDt UnexpectedDeletingTaskStateErrorRft_cleanup_volumesR‚R²R=R(RKRLR)RRôRêRaRÛRRR4RïRbR`R^t
decoded_filesRYRí((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR^Êsº
			
	
	

	

		



cCsL|j}d„}|rH|jrHx$|jD]}||ƒr+tSq+WntS(s#Determine if networks are needed to be deallocated before reschedule

        Check the cached network info for any assigned SR-IOV ports.
        SR-IOV ports should be deallocated prior to rescheduling
        in order to allow new sriov pci devices to be allocated on a new host.
        cSs|dtjkS(Nt	vnic_type(RtVNIC_TYPES_SRIOV(tvif((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_has_sriov_portRs(R¥RRJR²(RKR)R¥R€R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRvIs		cCsÌ|jdƒ}|j||ddi|d6ƒ|j||ƒy,|j|	ƒ}
|
j|||
ƒ|j|||ƒtjj|ƒ}|j	||||||ƒ¸}t
j|_t
j|_|jdt
jƒ|d}|d}tjdd	|ƒtjƒ/}|jj|||||d|d|ƒWdQXtjtd
ƒ|jƒd	|ƒWdQXWdQXWnÜtjtjfk
r¸}tjƒ|j||dd|ƒWdQXn’tj k
r }tj|j!ƒd	|ƒ|j||dd|ƒtj"d
|j#d|j!ƒƒ‚n*tj$k
rz}tjƒ7tj|j!ƒd	|ƒ|j||dd|ƒWdQXnÐtj%tj&tj'fk
r}tj(t)dƒd	|ƒ|j||dd|ƒt*dƒ|j!ƒ}tj$d
|j#d|ƒ‚nItj+tj,tj-tj.fk
r„}tjt/dƒd	|ƒ|j||dd|ƒt*dƒ}tj$d
|j#d|ƒ‚nÆtj0tj1tj2tj3tj4tj5tj6fk
rú}|j||dd|ƒtj$d
|j#d|j!ƒƒ‚nPt7k
rI}|j||dd|ƒtj"d
|j#dt8j9|ƒƒ‚nX|j:j;ddƒt=j>}|r|j?r|j@rx”|D]‰}|dd|kr‡xh|jAƒD]Z}|j?rÞ|ddkrÞ|d|_?n|j@r®|ddkr®|d|_@q®q®WPq‡q‡Wn|jB||ƒy|jdt
jƒWnKtjtjfk
r‹}tjƒ|j||dd|ƒWdQXnX|jC||ƒ|j||ddit*dƒd6d|ƒdS(NRšscreate.startRQt
image_nameRGRDRs.Start spawning the instance on the hypervisor.R)s;Took %0.2f seconds to spawn the instance on the hypervisor.screate.errorRRRIRàs+No more network or fixed IP to be allocatedsBFailed to allocate the network(s) with error %s, not rescheduling.sFailed to allocate network(s)s4Failed to allocate the network(s), not rescheduling.RR"tlabelR¼itaddressis
create.endtSuccesstmessage(DRzR8RiRîtinstance_claimRëR&t	ImageMetat	from_dictt_build_resourcesRRNR÷RRRRWRFRPRGRHRRVR0tspawnRYRRXRRCRzRR>tComputeResourcesUnavailableRZRæR‚RftFixedIpLimitExceededtNoMoreNetworkstNoMoreFixedIpsR]RRtVirtualInterfaceCreateExceptiont#VirtualInterfaceMacAddressExceptiontFixedIpInvalidOnHosttUnableToAutoAllocateNetworkRtFlavorDiskTooSmalltFlavorMemoryTooSmalltImageNotActivetImageUnacceptabletInvalidDiskInfotInvalidDiskFormattSignatureVerificationErrorR=Rt	text_typeRpRR\RÕtdefault_access_ip_network_nametaccess_ip_v4taccess_ip_v6t	fixed_ipsRIR­(RKRLR)RRÛRaRRR4RïRbRêRRíRt	resourcesRDRRYR^R`tnetwork_nameRtip((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRr[sÔ		


	


	

	



		


ccs i}d}y9tjdd|ƒ|j||||ƒ}||d<Wn¦tjtjfk
rg‚n‡tjk
r}	tjd|j	d|	j
ƒƒ‚nQtk
rítjtdƒd|ƒt
dƒ}
tjd|j	d|
ƒ‚nXyk|j|||ƒtjdd|ƒtj|_tj|_|jƒ|j|||ƒ}||d	<Wn"tjtjfk
rªtjƒ$|dk	r¡|jd
tƒnWdQXnÔtjtjtjfk
r}	|dk	rê|jd
tƒntjd|j	d|	j
ƒƒ‚nptk
r}tjtdƒd|ƒ|dk	rS|jd
tƒnt
dƒ}
tjd|j	d|
ƒ‚nXy	|VWntk
r›}tjƒñ}
t|tjtjfƒsßtjtd
ƒd|ƒn|dk	rþ|jd
tƒn|r
tnt}y |j||||d|ƒWn_tk
r‘}t|
_ tj!t"dƒt#j$|ƒƒtjd|j	dt#j$|ƒƒ‚nXWdQXnXdS(Ns4Start building networks asynchronously for instance.R)RRIRàsFailed to allocate network(s)s4Failed to allocate the network(s), not rescheduling.s2Start building block device mappings for instance.RDtdo_raisesFailure prepping block devicesFailure prepping block device.sInstance failed to spawnttry_deallocate_networkss<Could not clean up failed build, not rescheduling. Error: %s(%R\RGRHRRRCRzRXRfR‚RZR=RRR5RRNR÷RRPRWRFRERR>R±R²RCRDRBRJt_shutdown_instanceRR]RRRš(RKRLR)RRRR4RŸRR^R`RDRñtctxttdeallocate_networkstexc2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR‰Üs”


	


	
				cCsy|j|||ƒWn1tk
rJtdƒ}tj|d|ƒdSXd|jd<y|jƒWntjk
r|nXdS(NsFailed to deallocate networksR)R²R(RZR=RRGRRpRFRC(RKRLR)RR`((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRs;s

c	Cspy|j|||ƒWnRtk
rk}tjƒ1tjtdƒ|d|ƒ|j||ƒWdQXnXdS(Ns4Failed to deallocate network for instance. Error: %sR)(RZR=RR>RGR;RRù(RKRLR)RRO((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_try_deallocate_networkMs
cCsL|r6tj|dddtdtjƒ}|j}nd}d}||fS(s=Get the timing configuration for powering down this instance.RŽtimage_os_shutdown_timeoutttypetdefaulti(Rgtget_value_from_system_metadataRËRÕtshutdown_timeouttSHUTDOWN_RETRY_INTERVAL(RKRLR)tclean_shutdownR¯tretry_interval((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_power_off_valuesYscCs5|j|||ƒ\}}|jj|||ƒdS(s#Power off an instance on this host.N(R±R0t	power_off(RKRLR)R¯R¯R°((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_power_off_instancefs	cCsh|jƒ}tjtdƒd|d|ƒ|rG|j||dƒntj|ƒ}g|D]}|jr]|^q]}	|j||d|ƒ}
t	j
ƒ}y\tjdd|ƒ|jƒ|j
j||||
ƒtjtdƒ|jƒd|ƒWnftjk
r!tjƒWdQXn@tk
r`tjƒ!|rW|j|||ƒnWdQXnX|r}|j|||ƒn|jƒx|	D]w}yK|j
j|ƒ}|jj||j|ƒ|jj||j|jƒWqŽtjk
r
}
tjd	|
d|ƒqŽtjk
r8}
tjd
|
d|ƒqŽtj t!j fk
rƒ}
tj"t#dƒi|
d6|jd
6d|ƒqŽtj$k
rÅ}
tj"t#dƒi|
d6|jd
6d|ƒqŽtk
r}
tj"t#dƒi|
d6|jd
6d|ƒqŽXqŽW|	rHtjtdƒi|jƒd6t%|	ƒd6d|ƒn|rd|j||dƒndS(sGShutdown an instance on this host.

        :param:context: security context
        :param:instance: a nova.objects.Instance object
        :param:bdms: the block devices for the instance to be torn
                     down
        :param:requested_networks: the networks on which the instance
                                   has ports
        :param:notify: true if a final usage notification should be
                       emitted
        :param:try_deallocate_networks: false if we should avoid
                                        trying to teardown networking
        sTerminating instanceRLR)sshutdown.startR3s0Start destroying the instance on the hypervisor.s=Took %0.2f seconds to destroy the instance on the hypervisor.NsIgnoring DiskNotFound: %ssIgnoring VolumeNotFound: %ss;Ignoring EndpointNotFound for volume %(volume_id)s: %(exc)sRñRÂsCIgnoring unknown cinder exception for volume %(volume_id)s: %(exc)ss<Ignoring unknown exception for volume %(volume_id)s: %(exc)ss?Took %(time).2f seconds to detach %(num)s volumes for instance.RÆRðsshutdown.end(&R|RGRYRR8RgRqt	is_volumeRRRVRHRÌR0RRXRtInstancePowerOffFailureRR>R=R¨trestarttget_volume_connectorRÁtterminate_connectionRÂtdetachR‚tDiskNotFoundtVolumeNotFoundtcinder_exceptiontEndpointNotFoundtkeystone_exceptionR]RtClientExceptionRý(RKRLR)R3RtnotifyR£RR@tvol_bdmsRDRYt	connectorRñ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¤ls~

"

	



 



 
cCsÝd}xœ|D]”}tjd|d|ƒ|jr
|jr
y|jj||jƒWq¡tk
r}tj	ƒ}tj
tdƒi|jd6|d6ƒq¡Xq
q
W|dk	rÙ|rÙtj
|d|d|dƒndS(	Nsterminating bdm %sRIs5Failed to delete volume: %(volume_id)s due to %(exc)sRÂRñiii(R\RGRHRÂtdelete_on_terminationRÁRmR=RiR<R]RRR(RKRLRIR3RoR<R@Rñ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR{Ïs
#tdelete_instancecCsË|jtjk}|r=y|jƒWq=tk
r9q=Xny@|jj|ƒ}|r‡tjdidj	|j
ƒƒd6d|ƒn|j||dƒtj
|||jdtjjdtjjƒ|j|||ƒ|jd
k	rú|jjƒntjtdƒd|ƒ|j||j|d	tƒtj|_d
|_tj |_t!j"ƒ|_#|j$ƒ|j%}|j&ƒWn.tk
r­t'j(ƒ|jƒWd
QXnX|j)|||||ƒd
S(sMDelete an instance on this host.  Commit or rollback quotas
        as necessary.

        :param context: nova request context
        :param instance: nova.objects.instance.Instance object
        :param bdms: nova.objects.block_device.BlockDeviceMappingList object
        :param quotas: nova.objects.quotas.Quotas object
        s&Events pending at deletion: %(events)st,RR)sdelete.startR5R6s3Info cache for instance could not be found. Ignore.RoN(*R÷RRJtrollbackR=R‡R˜RGRHtjoinR”R8RgR9RëR(R:R;R<tSTARTR¤R¥R\RmR]RR{R‚R²RMRWRR²RRFt
terminated_atRFRpRRR>R1(RKRLR)R3R+twas_soft_deletedRR2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR_àsN

	

	
	

	csStjjˆ|d|ƒ‰tj|jƒ‡‡‡fd†ƒ}|||ƒdS(s#Terminate an instance on this host.R)csóxVt|ƒD]H}|jr
|jr
tjdd|ƒtjjˆ|jƒ}Pq
q
Wyˆj	ˆ||ˆƒWnyt
jk
r¢tjt
dƒd|ƒnMtk
rîtjƒ.tj
tdƒd|ƒˆjˆ|ƒWdQXnXdS(NsVThere are potentially stale BDMs during delete, refreshing the BlockDeviceMappingList.R)s%Instance disappeared during terminates"Setting instance vm_state to ERROR(R*R´RÂRGRHR&R(R)R‚R_RRCRYRR=RR>RRù(R)R3R@(RLR+RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_terminate_instance5	s"
	


N(R&R*tfrom_reservationsRR‹R‚(RKRLR)R3treservationsRË((RLR+RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytterminate_instance+	s
	'cs5tjˆjƒ‡‡‡‡fd†ƒ}|ƒdS(s"Stopping an instance on this host.csˆjˆˆƒ}tjdiˆjd6ˆjd6ˆjd6|d6dˆjƒtjg}|tj	tj
tjfkr£tjt
dƒdˆƒ|jdƒnˆjˆˆd	ƒˆjˆˆˆƒˆjˆˆƒˆ_tjˆ_dˆ_ˆjd
|ƒˆjˆˆdƒdS(Ns²Stopping instance; current vm_state: %(vm_state)s, current task_state: %(task_state)s, current DB power_state: %(db_power_state)s, current VM power_state: %(current_power_state)sR÷RWRŒRyRIsFInstance is already powered off in the hypervisor when stop is called.R)spower_off.startRGs
power_off.end(R`RGRHR÷RWRR‚RRmR²R–tCRASHEDRYRRR\R8R³RRTRF(RyRG(R¯RLR)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_stop_instance`	s.	




		N(RR‹R‚(RKRLR)R¯RÐ((R¯RLR)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRnY	s*%cCsD|jj||ƒ}|j||ƒ}|jj||||ƒdS(N(RÀRRR0R}(RKRLR)RRD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt	_power_on‡	s		cCsˆy|jj||ƒWnjtjtjfk
rZ}tjtdƒ|jƒd|ƒn*t	k
rƒtjt
dƒd|ƒnXdS(s$Delete snapshot of shelved instance.s5Failed to delete snapshot from shelved instance (%s).R)sNSomething wrong happened when trying to delete snapshot from shelved instance.N(RlRmRt
ImageNotFoundtImageNotAuthorizedRGR]RRZR=R(RKRLR)tsnapshot_idRñ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt$_delete_snapshot_of_shelved_instance	s
cCs|j||dƒtj|||jdtjjdtjjƒ|j	||ƒ|j
||ƒ|_tj
|_d|_|jjdƒ}|r©|j|||ƒntj|ƒ|jdtjƒ|j||dƒtj|||jdtjjdtjjƒdS(s"Starting an instance on this host.spower_on.startR5R6tshelved_image_idRGspower_on.endN(R8RgR9RëR(R:tPOWER_ONR<RÈRÑR`RRRSR÷R\RWRpRzRÕt(remove_shelved_keys_from_system_metadataRFRRoR=(RKRLR)RÔ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRp¡	s$
	

cCs:|j||dƒ|jj|ƒ|j||dƒdS(s"Trigger crash dump in an instance.strigger_crash_dump.startstrigger_crash_dump.endN(R8R0ttrigger_crash_dump(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRÙ¿	s
	cCsütjj||d|ƒ}y|j||dƒy|jj|ƒWn!tk
rh|jj|ƒnX|j||ƒ|_	t
j|_d|_|jdtjgƒWn.tk
rÚtjƒ|jƒWdQXnX|jƒ|j||dƒdS(s%Soft delete an instance on this host.R)ssoft_delete.startRGNssoft_delete.end(R&R*RÌR8R0tsoft_deleteRR²R`RRRJR÷R\RWRFRt
SOFT_DELETINGR=RR>RÆR7(RKRLR)RÍR+((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytsoft_delete_instanceÒ	s&	
	


cCsû|j||dƒtj|||jdtjjdtjjƒy|j	j
|ƒWn!tk
rx|j||ƒnX|j
||ƒ|_tj|_d|_|jdtjƒ|j||dƒtj|||jdtjjdtjjƒdS(s-Restore a soft-deleted instance on this host.s
restore.startR5R6RGsrestore.endN(R8RgR9RëR(R:tRESTORER<RÈR0trestoreRRÑR`RRRSR÷R\RWRFRt	RESTORINGR=(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytrestore_instanceï	s 

	cCs |r||_|jƒndS(sSet the status, and guard against a None being passed in.

        This is useful as some of the compute RPC calls will not pass
        a migration object in older versions. The check can be removed when
        we move past 4.x major version of the RPC API.
        N(RDRF(R9RD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_set_migration_status
s	c
Cs|rtjƒ‚n|
r+|||ƒnB|j||dtƒ|||ƒ|jj||d|	d|ƒtj|_|j	dtj
gƒ||||ƒ}
tj|_|j	dtjgƒ|jƒ-|jj
|||||d|	d|
ƒWdQXdS(NR¯RRDRG(RtPreserveEphemeralNotSupportedR³RJR0RRRVRWRFRURWtmutated_migration_contextRŠ(RKRLR)RRÛRaR3tdetach_block_devicesRARtrecreateRDtpreserve_ephemeraltnew_block_device_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_rebuild_default_impl
s&
	

cCs­|jƒ}tjtdƒd|d|ƒ|
dk	rR|j|
ƒ}|j}n	tj}i}|r|j	j
||ƒ}n|
sì|	rày"|j||jƒ}|j
}
Wqétjk
rÜtjtdƒ|jƒqéXqì|j}
n|j||ƒ©yS|||d|d|d|ƒ}|j||||||||||	|
|ƒWntjk
rÇ}tjdd|ƒ|j|d	ƒ|j||d
d|ƒtjd|jd
|jƒƒ‚nÜtjtjfk
r!}tjdd|ƒ|j|d	ƒ|j||d
d|ƒn‚tk
r_}|j|d	ƒ|j||d
d|ƒ‚nDX|jƒ|j|_|
|_|jƒ|j ƒ|j|dƒWdQXdS(s×Destroy and re-make this instance.

        A 'rebuild' effectively purges all existing data from the system and
        remakes the VM with given 'metadata' and 'personalities'.

        :param context: `nova.RequestContext` object
        :param instance: Instance object
        :param orig_image_ref: Original image_ref before rebuild
        :param image_ref: New image_ref for rebuild
        :param injected_files: Files to inject
        :param new_pass: password to set on rebuilt instance
        :param orig_sys_metadata: instance system metadata from pre-rebuild
        :param bdms: block-device-mappings to use for rebuild
        :param recreate: True if the instance is being recreated (e.g. the
            hypervisor it was on failed) - cleanup of old state will be
            skipped.
        :param on_shared_storage: True if instance files on shared storage.
                                  If not provided then information from the
                                  driver will be used to decide if the instance
                                  files are available or not on the target host
        :param preserve_ephemeral: True if the default ephemeral storage
                                   partition must be preserved on rebuild
        :param migration: a Migration object if one was created for this
                          rebuild operation (if it's a part of evacuate)
        :param scheduled_node: A node of the host chosen by the scheduler. If a
                               host was specified by the user, this will be
                               None
        :param limits: Overcommit limits set by the scheduler. If a host was
                       specified by the user, this will be None
        sRebuilding instanceRLR)s!Failed to get compute_info for %sRbRR9sHCould not rebuild instance on this host, not enough resources available.R›s
rebuild.errorRRRIRàs%Instance was deleted while rebuildingR
N(!R|RGRYRR\Rît
rebuild_claimRtNopClaimRlRzt_get_compute_infoRëthypervisor_hostnameRtComputeHostNotFoundRRït _error_out_instance_on_exceptiont_do_rebuild_instance_with_claimR‹RHRáR8RfR‚RZRCRzR=tapply_migration_contextRFtdrop_migration_context(RKRLR)torig_image_refRRÛtnew_passtorig_sys_metadataR3Råton_shared_storageRæR9tscheduled_nodeRbRíRéRtcompute_nodet
claim_ctxtR^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytrebuild_instance6
sl(	
	
	

	

cOs!||j||ŽWdQXdS(s5Helper to avoid deep nesting in the top-level method.N(t_do_rebuild_instance(RKt
claim_contextRMRN((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRïª
scCs|jdƒr|jSdSdS(NRšt(tobj_attr_is_setRš(R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_image_name°
scsÈj}|	ráˆjjds+tj‚nˆj|ˆƒ|
dkritjdƒˆjj	ˆƒ}
n0|
ˆjj	ˆƒkr™tj
tdƒƒ‚n|
rµtjt
dƒƒqáˆj}}tjt
dƒt|ƒƒn|rtjj|ˆj|ƒ}
n	ˆj}
tj|ƒ}i|d6}tjˆj|ˆdtd|d	|ƒiˆj|
ƒd
6}ˆj|ˆdd	|ƒˆj|ˆƒˆ_tj ˆ_!ˆj"dtj gƒ|	róˆj#j$|ˆˆj%ƒˆj#j&|ˆˆj%ƒntj'ˆƒ}|dkr)tj(j)|ˆj*ƒ}nˆj+|ˆd
|ƒ}‡‡fd†}ˆj,|ƒ}t-d|dˆd|
d|d|d
|d|dˆj.d|d|d|d|	ƒ}y'ˆj/ƒˆjj0|WdQXWnt1k
rýˆj2|nXˆj3|ˆƒˆj"dtj4gƒ|t5j6krtjt
dƒ|dˆƒt5j7ˆ_tj8ˆ_!dˆ_9ˆj"ƒˆj:|ˆt;ƒnˆj<|ˆƒˆj|ˆdd|d	|ƒdS(Ntsupports_recreatesion_shared_storage is not provided, using driverinformation to decide if the instance needs tobe recreateds1Invalid state of instance files on shared storages6disk on shared storage, recreating using existing disks1disk not on shared storage, rebuilding from: '%s't
image_ref_urltcurrent_periodRpRQRs
rebuild.startRGR3cs=x6|D].}|jrˆj||jˆdtƒqqWdS(Ntdestroy_bdm(R´t_detach_volumeRÂR²(RLR3R@(R)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRäs
	RLR)RRÛRaRäRARDRRæRås#bringing vm to original state: '%s'isrebuild.end(=R÷R0ReRtInstanceRecreateNotSupportedRÿR\RGRHtinstance_on_disktInvalidSharedStorageRRYRRtstrR&R‡tfrom_image_refRlRR tgenerate_image_urlRgtnotify_usage_existsRTRJRþR8R`RRRURWRFRÀtsetup_networks_on_hostRëRRqR(R)R‚RRÜRcRERãtrebuildRRèRIRWRRTRSRmtprogressRnR²R­(RKRLR)RòRRÛRóRôR3RåRõRæt
orig_vm_stateRtorig_image_ref_urlRQRRDRätfilesRN((R)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRú·
sž	

		

					


	
cCsÂx»|dD]¯}|jdƒ|kry|ddd}Wntk
rRqnXtjtdƒ|ƒ|jj||ƒ}|jj||ƒ|jj||ƒ|j|||ƒqqWdS(swHandle cases where the virt-layer had to detach non-working volumes
        in order to complete an operation.
        R4tmount_deviceR[RRÂsDetaching from volume api: %sN(	RzRyRGRYRRÁtcheck_detachtbegin_detachingt
detach_volume(RKRLR)tbad_devicesRDR@RÂRÎ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_handle_bad_volumes_detached3s
csd|dkr3tjˆ_tjtjtjf}n$tjˆ_tjtjtjf}ˆjƒ‰t	j
tdƒdˆdˆƒˆjˆˆƒ‰ˆj
jˆˆƒ}ˆjˆˆdƒˆjˆˆƒˆ_ˆjd|ƒˆjtjkr8ˆj}tj}t	jtdƒi|d6|d	6dˆdˆƒn‡‡‡‡fd
†}	yŸˆjtjkrqtj}
n	tj}
d}|dkr¤tjˆ_tj}ntjˆ_tj}ˆjd|ƒˆjjˆˆ||dˆd|	ƒWnátk
rÒ}
tjƒÀ}t j!ƒ}ˆjˆˆƒ}|tjkr—t	jtd
ƒdˆdˆƒt"j#ˆˆ|
|ƒˆjˆˆdd|
ƒt$|_%n2t	j&t'dƒ|
dˆdˆƒˆj(ˆˆƒWdQXnX|sîˆjˆˆƒ}ny)|ˆ_|
ˆ_dˆ_ˆjƒWn3t)j*k
rLt	jtdƒdˆdˆƒnXˆjˆˆdƒdS(s Reboot an instance on this host.tSOFTsRebooting instanceRLR)sreboot.startRGsQtrying to reboot a non-running instance: (state: %(state)s expected: %(running)s)R‰trunningcsˆjˆˆ|ˆƒdS(N(R(R(RDRLR)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytbad_volumes_callbacktsRDRs%Reboot failed but instance is runningsreboot.errorRRsCannot reboot instance: %sNs"Instance disappeared during reboots
reboot.end(+RRcRWRdRbRetREBOOTING_HARDRhR|RGRYRRRÀRR8R`RRFRgR]RR÷RtRESCUEDRSR\R0trebootR=RR>RiR<RgRhR²RR;RRùRRC(RKRLR)RDREtexpected_statesRR‰RRtnew_vm_statetnew_power_statetexpected_stateR;R¥R<((RDRLR)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRfMs„						
	


			cCs|j|||tjƒdS(N(t_snapshot_instanceRtIMAGE_BACKUP(RKRLRkR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_do_snapshot_instance¬scCs-|j|||ƒ|j||||ƒdS(sŸBackup an instance on this host.

        :param backup_type: daily | weekly
        :param rotation: int representing how many backups to keep around
        N(R#t_rotate_backups(RKRLRkR)tbackup_typetrotation((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytbackup_instance±s
cCs˜y#tj|_|jdtjƒWnUtjk
rStjdtjd|ƒdStj	k
rztjdd|ƒdSX|j
|||tjƒdS(sÔSnapshot an instance on this host.

        :param context: security context
        :param instance: a nova.objects.instance.Instance object
        :param image_id: glance.db.sqlalchemy.models.Image.Id
        RGs8Instance not found, could not set state %s for instance.R)Ns0Instance being deleted, snapshot cannot continue(RR[RWRFRXRRCRGRHRzR!(RKRLRkR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytsnapshot_instance¾s		cs|jƒ}|j|ˆƒˆ_yëˆjƒtjtdƒd|dˆƒˆjtjkržˆj}tj}tjt	dƒi|d6|d6dˆƒn|j
|ˆdƒ|‡fd†}|jj|ˆ||ƒdˆ_ˆjd	tjƒ|j
|ˆd
ƒWnðtjtjfk
r¹d}tj|dˆƒyEtjƒ}	|	j||ƒ}
|
dd
kr…|	j||ƒnWqÿtk
rµtjt	dƒ|dˆƒqÿXnFtjk
rþdˆ_ˆjƒt	dƒ}tj|dˆƒnXdS(Nsinstance snapshottingRLR)sStrying to snapshot a non-running instance: (state: %(state)s expected: %(running)s)R‰Rssnapshot.startcs|ˆ_ˆjd|ƒdS(NRG(RWRF(RWR (R)(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytupdate_task_stateös	RGssnapshot.ends$Instance disappeared during snapshotRDtactives'Error while trying to clean up image %ssImage not found during snapshot(R|R`RRFRGRYRRgR]RR8R0tsnapshotR\RWRRZRRCRzRHR tget_default_image_servicetshowRmR=RÒ(RKRLRkR)RGR‰RR)R`t
image_serviceR((R)sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR!àsL
		

	
	
cCs|jj||ƒdS(N(R0t!post_interrupted_snapshot_cleanup(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR\scCs|jj||||ƒdS(N(R0tvolume_snapshot_create(RKRLR)RÂtcreate_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR0scCs |jj|||||ƒdS(N(R0tvolume_snapshot_delete(RKRLR)RÂRÔtdelete_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR2!scCsidd6|d6|jd6}|jj|d|dddd	ƒ}t|ƒ}tjd
i|d6|d6d
|ƒ||krýt|ƒ|}tjd|d
|ƒxVt|ƒD]E}	|jƒ}
|
d}tjd|d
|ƒ|jj||ƒq±WndS(sDelete excess backups associated to an instance.

        Instances are allowed a fixed number of backups (the rotation number);
        this method deletes the oldest backups that exceed the rotation
        threshold.

        :param context: security context
        :param instance: Instance dict
        :param backup_type: a user-defined type, like "daily" or "weekly" etc.
        :param rotation: int representing how many backups to keep around;
            None if rotation shouldn't be used (as in the case of snapshots)
        tbackupsproperty-image_typesproperty-backup_typesproperty-instance_uuidRtsort_keyRútsort_dirtdescs4Found %(num_images)d images (rotation: %(rotation)d)t
num_imagesR&R)sRotating out %d backupstidsDeleting image %sN(	R‚Rltget_allRýRGRHR	RRm(RKRLR)R%R&RtimagesR8texcesstiRRk((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR$(s&

	
cCsl|jƒ}|dkr'tjƒ}n|j||ƒ}tj}||kr›d|_|jdt	j
ƒtdƒ|j}t
jd|jd|ƒ‚nyL|jj||ƒtjtdƒd|ƒd|_|jdt	j
ƒWn~t
jk
r?tjƒ4tjdd|ƒd|_|jdt	j
ƒWdQXn)t
jk
rštjƒ:tjtdƒd|ƒd|_|jdt	j
ƒWdQXnÎtk
rñtjtd	ƒd|ƒd|_|jdt	j
ƒttd	ƒƒ‚nwt
jk
r‚natk
rgtj
td
ƒd|ƒ|j||ƒtdƒ}t
jd|jd|ƒ‚nXdS(s@Set the root/admin password for an instance on this host.

        This is generally only called by API password resets after an
        image has been built.

        @param context: Nova auth context.
        @param instance: Nova instance object.
        @param new_pass: The admin password for the instance.
        RGsinstance %s is not runningR)RàsRoot password sets,Guest agent is not enabled for the instance.NsEset_admin_password is not supported by this driver or guest instance.sGset_admin_password is not implemented by this driver or guest instance.sset_admin_password failedserror setting admin password( R|R\Rtgenerate_passwordR`RRgRWRFRtUPDATING_PASSWORDRR‚RtInstancePasswordSetFailedR0tset_admin_passwordRGRYRtInstanceAgentNotEnabledRR>RHtSetAdminPasswdNotSupportedRR]RRXR=RRù(RKRLR)RóRyR t_msg((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRANs^					
		
		
		

	cCs–|jƒ}|j||ƒ}tj}||kr`tjtdƒi|d6|d6d|ƒntjtdƒ|d|ƒ|j	j
|||ƒdS(s?Write a file to the specified path in an instance on this host.sbtrying to inject a file into a non-running (state: %(current_state)s expected: %(expected_state)s)t
current_stateR R)sinjecting file to %sN(R|R`RRgRGR]RRYRR0tinject_file(RKRLRÐt
file_contentsR)RyR ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRF›s	


cCsk|s'tj|ƒ}|jdƒ}n|sRtjtdƒd|ƒ|j}ntjj	||j
|ƒS(s:Determine what image should be used to boot the rescue VM.timage_base_image_refsUUnable to find a different image to use for rescue VM, using instance's current imageR)(Rtinstance_sys_metaRzRGR]RRR&R‡RRl(RKRLR)trescue_image_refR2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_rescue_image±s		cCsÄ|jƒ}tjtdƒd|d|ƒ|r7|n	tjƒ}|jj||ƒ}|j|||ƒ}i|j	|ƒd6}	|j
||dd|	d|ƒy3|j|||ƒ|jj
|||||ƒWnatk
r8}
tjtdƒd|ƒ|j||ƒtjd	|jd
tdƒ|
ƒ‚nXtj|j||dtƒtj|_d|_|j||ƒ|_t j!ƒ|_"|j#d
t$j%ƒ|j
||dd|	d|ƒdS(NtRescuingRLR)trescue_image_namesrescue.startRQRsError trying to Rescue Instancetinstance_idRàsDriver Error: %sRRGs
rescue.end(&R|RGRYRRR>RÀRRKRþR8R³R0trescueR=RRRùtInstanceNotRescuableR‚RRgR
RTRJRRR÷R\RWR`RRRFRGRFRtRESCUING(RKRLR)trescue_passwordRJR¯RaRtrescue_image_metaRQR^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytrescue_instanceÇsD				cCsß|jƒ}tjtdƒd|d|ƒ|jj||ƒ}|j||dd|ƒ|j||ƒ|jj	||ƒWdQXt
j|_d|_|j||ƒ|_|jdtjƒ|j||dd|ƒdS(Nt
UnrescuingRLR)sunrescue.startRRGsunrescue.end(R|RGRYRRÀRR8RîR0tunrescueRRSR÷R\RWR`RRFRt
UNRESCUING(RKRLR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytunrescue_instanceùs 

		cCs0tjd|d|ƒ|jj|||ƒdS(s.Update the metadata published to the instance.s*Changing instance metadata according to %rR)N(RGRHR0tchange_instance_metadata(RKRLtdiffR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRY
s	
csVtjj||d|ƒ‰tj|jƒ‡‡fd†ƒ}||||jƒdS(NR)cstjd|d|d|ƒytjj|jƒ|ƒ}WnAtjk
r~tjt	dƒ|d|d|ƒˆj
ƒdSX|jdkr¾tjt
dƒ|d|d|ƒˆj
ƒdS|jdkrtjtd	ƒi|jd
6|d6d|d|ƒˆj
ƒdSdd
dg}y"tjj||jd|ƒ}Wn>tjk
rtjt
dƒd|d|ƒˆj
ƒdSXˆj||ˆd|ƒdS(NsGoing to confirm migration %sRLR)s-Migration %s is not found during confirmationt	confirmeds!Migration %s is already confirmedtfinishedt
confirmingsZUnexpected confirmation status '%(status)s' of migration %(id)s, exit confirmation processRDR9RoRpR.Rqs)Instance is not found during confirmationR9(sfinishedR](RGRHR&R{t	get_by_idR|RtMigrationNotFoundR;RRÆRDRYRR]RRrR’R‚RCt_confirm_resize(RLR)tmigration_idR9Rq(R+RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_confirm_resize#
sB
	



	


(R&R*RÌRR‹R‚R9(RKRLR)RÍR9Rb((R+RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytconfirm_resize
s
	$/c
Csª|j||dƒ|j||d|ƒy|j}d|_d|_|jjddƒ|jƒ|jj	|||j
dtƒ|jj||ƒ}|j
j|||ƒd|_|jƒ|jƒWdQX|j|jƒ}|j|||ddƒ|jƒ|j}d}	|tjkrItj}	tjd	|	d
|ƒn	tj}	|	|_d|_|jddtjgƒ|j||dd
|ƒ|j ƒWdQXdS(sDestroys the source instance.sresize.confirm.startR+RFtteardownR[NRktold_sCResized/migrated instance is powered off. Setting vm_state to '%s'.R)RGsresize.confirm.endR(!R8Rît
old_flavorR\t
new_flavorRpRRFRÀRRRJRR0tconfirm_migrationRDRERîtsource_nodetdrop_move_claimRñRR–RRTRGRHRSR÷RWRRLR7(
RKRLR)R+R9told_instance_typeRRítp_stateR÷((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR`T
sJ
			
		

			
			cCs¦tjj||d|ƒ}tj|j||dtƒ|j||d|ƒQ|jj	||dtƒt
j|ƒ}|jj|||ƒ|jj
||ƒ}tjj||jƒ}|j||d|ƒ}	|j||d|jƒ}
|jj||||	|
ƒ|j|||ƒd|_|jƒ|jƒWdQX|jƒ|jƒ|j|jƒ}|j||ƒ|jj||||j|j ƒWdQXdS(	s¡Destroys the new instance on the destination machine.

        Reverts the model changes, and powers on the old instance on the
        source machine.

        R)RR+RdR3RëtrevertedN(!R&R*RÌRgR
RTRJRîRÀRtobj_basetobj_to_primitivetmigrate_instance_startRR(R)R‚RRRR0Rt_terminate_volume_connectionsRDRERFtrevert_migration_contextRîRïRjRÇtfinish_revert_resizeRÍ(RKRLR)R9RÍR+tmigration_pRR3RDRRí((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
revert_resize
sD
	
		
	
	

	cCs+tjj||d|ƒ}|j||d|ƒò|j||dƒ|jjdtjƒ}|j	||j
ƒd|_
d|_|j
|_|j|_|jƒ|j
|_|jƒ|jƒWdQX|jj|||j
ƒtj|ƒ}|jj|||ƒ|jj||ƒ}|j||dtƒ}	|tjk}
|jj||||	|
ƒ|jƒt j!ƒ|_"|jdt#j$ƒt%j&t'dƒ|d|ƒ|
rÕtj|_(d|_)|jƒn/t#j*|_)|jƒ|j+|d|d	tƒ|j||d
ƒ|j,ƒWdQXdS(s¼Finishes the second half of reverting a resize.

        Bring the original source instance state back (active/shutoff) and
        revert the resized attributes in the database.

        R)R+sresize.revert.startRFNR]RGs)Updating instance to original state: '%s'R¯sresize.revert.end(-R&R*RÌRîR8RpRRRSt_set_instance_infoRfR\RgRRëRiRïRFtdest_computeRERÀRRnRotmigrate_instance_finishRRRJRTR0RtRñRRFRGRtRESIZE_REVERTINGRGRYRR÷RWRmRnR7(RKRLR)RÍR9R+RFRtRRDR}((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRsÓ
s`
	

		


	


	


c

Cs}|si}n|jsI|j||ƒtdƒ}
tjd|
ƒ‚n|j|jk}|r¨|j|dkr¨|jjds¨tjd|j	d|jƒ‚q¨n||_
|j}tj
d|d|ƒ||jd	<|jƒ|jd
iƒ}
|j|ƒ}|j|||d|d
|
ƒN}tjtdƒd
|d|ƒ|jj|||j|||j|	ƒWdQXdS(NsInstance has no source hostRàtinstance_type_idtsupports_migrate_to_same_hostRNRësStashing vm_state: %sR)RFRbRt	MigratingRL(RëRùRRtMigrationErrorR9R0RetUnableToMigrateToSelfR‚RgR÷RGRHRpRFRzRîtresize_claimRYRRÇtresize_instanceR9RÍ(RKRLRR)t
instance_typeR+RôRêRïR¯R`t	same_hostR÷RbRítclaim((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_prep_resize s2					

		c

Cs–|d	kr>|jjdtƒd}tjd|d|ƒnt|tjƒsltjj	||dƒ}ntj
j||d|ƒ}
|j||d|
ƒñt
j|j||dtƒ|j||dƒz…y)|j|||||
||||	ƒ	WnUtjk
r‚n?tk
rRtjƒ}|j||||||
||ƒnXWd	td
|jd|jƒ}|j||dd
|ƒXWd	QXd	S(sInitiates the process of moving a running instance to another host.

        Possibly changes the RAM and disk size in the process.

        Rlis#No node specified, defaulting to %sR)R9R+Rsresize.prep.startNtnew_instance_typetnew_instance_type_idsresize.prep.endRQ(R\R0RqRJRGRHRBR&tFlavorR^R*RÌRîRgR
RTR8R„RtMigrationPreCheckErrorR=RiR<t_reschedule_resize_or_reraiseRcRšR9(
RKRLRR)RRÍRôRêRïR¯R+R<RQ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytprep_resizeHsF
	


	c		Csb|si}n|si}nt}	|j}
yd|jj}td|ƒ}|d|||jf}
tj}|j	||||||
||ƒ}	Wnjt
k
rý}t}	tjt
dƒd|
ƒtj|||dtjƒƒ|j||dd|ƒnX|	rQ|j||
ƒtj|||dd|ƒ|j||dd|dƒn
tj|ŒdS(	shTry to re-schedule the resize or re-raise the original error to
        error out the instance.
        RêsError trying to rescheduleRIR<sresize.errorRRiN(R²R‚RËR€RcR\RÍRR]R÷R=RGRRRgRhRiR<R8RìRR(RKRLRR)R<RR+RôRêtrescheduledRIRõtscheduler_hintRöRWR;((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR‰‚s>							
	cCs¡tjj||d|ƒ}|j||d|ƒh|sNt|tjƒrjtjj||dƒ}n|jj||ƒ}	d|_	|j
ƒ|jƒWdQXtj
|_|jdtjƒ|j||dd|	ƒtj|||jd	tjjd
tjjƒtjj||jƒ}
|j||d|
ƒ}|j|||ƒ\}}
|jj|||j ||	|||
ƒ}|j!|||
ƒt"j#|ƒ}|jj$|||ƒd|_	|j
ƒ|jƒWdQX|j%|_|j&|_'tj(|_|jdtj
ƒ|j)j*||||||j%d
|j+ƒ|j||dd|	ƒtj|||jd	tjjd
tjj,ƒ|j-j.|ƒWdQXdS(s;Starts the migration of a running instance to another host.R)R+R†R:NRGsresize.startRR5R6R3spost-migratingRÍs
resize.end(/R&R*RÌRîRBR‡R^RÀRRDRERFRRKRWR]R8RgR9RëR(R:tRESIZER<RÈR(R)R‚RR±R0tmigrate_disk_and_power_offt	dest_hostRqRnRoRpRwt	dest_nodeRïtRESIZE_MIGRATEDRÇt
finish_resizeRÍR=R‡R˜(RKRLR)RRÍR9RR¯R+RR3RDR¯R°t	disk_infoRt((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR€­sj
	
			

				
	
cCsL|jj|ƒ}x3|D]+}|jr|jj||j|ƒqqWdS(N(R0R·R´RÁR¸RÂ(RKRLR)R3RÂR@((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRqþs

	cCsI|j|_|j|_|j|_|j|_|j|_||_dS(N(R9RzR0R/troot_gbtephemeral_gbR.(R)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRvsc
Cs]t}|d}|d}|jƒ}	|jjdtjƒ}
|	|_||kr¤|jdƒ}|j||ƒx/dD]$}|	|||kryt}PqyqyWn|j	ƒ|j
j|||dƒtj
|ƒ}
|j
j|||
ƒ|j
j||ƒ}tj|_|jd	tjƒ|j||d
d|ƒ|j||dtƒ}|
tjk}y,|jj|||||||||ƒ	WnCtk
rÒtjƒ$||krÉ|j||	ƒnWdQXnXd
|_|jƒ|jƒWdQXtj|_ d|_t"j#ƒ|_$|jd	tjƒ|j%||ƒ|j||dd|ƒdS(Ntold_instance_type_idR†RFtnewR”R3R•RwRGsfinish_resize.startRR]R\sfinish_resize.end(sroot_gbsswapsephemeral_gb(&R²t
get_flavorRpRzRRSRfRvRJRðRÀRRnRoRxRRt
RESIZE_FINISHRWRFR‘R8RRTR0tfinish_migrationR=RR>RDREtRESIZEDR÷R\RRFRGR­(RKRLR)R9R“RR€R–R†RkRFRRŽRtRRDR}((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_finish_resizesh

	



		
	c		Csãtjj||d|ƒ}y9tjj|ƒ}|j|||||ƒ|jƒWnˆtk
rÞtj	t
dƒd|ƒtjƒPy|j
ƒWn*tk
rÄtj	t
dƒd|ƒnX|j||ƒWdQXnXdS(s‘Completes the migration process.

        Sets up the newly transferred disk and turns on the instance at its
        new host machine.

        R)s"Setting instance vm_state to ERRORs1Failed to rollback quota for failed finish_resizeN(R&R*RÌR‡RˆRœR7R=RGRRRR>RÆRù(	RKRLR“RR)RÍR9R+R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR’Ys$
	



cCs„|j||dƒ|jj|||ƒ}|j|||ƒ|j||ƒtjƒ|_|jƒ|j||dd|ƒdS(s…Calls network_api to add new fixed_ip to instance
        then injects the new network info and resets instance networking.

        screate_ip.starts
create_ip.endRN(	R8RÀtadd_fixed_ip_to_instancet_inject_network_infot
reset_networkRRFt
updated_atRF(RKRLt
network_idR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRzs
	
cCs„|j||dƒ|jj|||ƒ}|j|||ƒ|j||ƒtjƒ|_|jƒ|j||dd|ƒdS(sCalls network_api to remove existing fixed_ip from instance
        by injecting the altered network info and resetting
        instance networking.
        sdelete_ip.starts
delete_ip.endRN(	R8RÀtremove_fixed_ip_from_instanceRžRŸRRFR RF(RKRLRƒR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¢‘s
	
cCsþ|jƒ}tjtdƒd|d|ƒ|j||dƒtj|||jdtj	j
dtjjƒ|j
j|ƒ|j||ƒ|_tj|_d	|_|jdtjƒ|j||dƒtj|||jdtj	j
dtjjƒd	S(
sPause an instance on this host.tPausingRLR)spause.startR5R6RGs	pause.endN(R|RGRYRR8RgR9RëR(R:tPAUSER<RÈR0tpauseR`RRRkR÷R\RWRFRRiR=(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytpause_instance¨s
	cCs¢|jƒ}tjtdƒd|d|ƒ|j||dƒ|jj|ƒ|j||ƒ|_t	j
|_d|_
|jdtjƒ|j||dƒdS(s'Unpause a paused instance on this host.t	UnpausingRLR)s
unpause.startRGsunpause.endN(R|RGRYRR8R0tunpauseR`RRRSR÷R\RWRFRRj(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRl¾s	cCs|jj|ƒS(s*Reboots, shuts down or powers up the host.(R0thost_power_action(RKRLR5((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR©ÎscCs|jj||ƒS(s`Start/Stop host maintenance window. On start, it triggers
        guest VMs evacuation.
        (R0thost_maintenance_mode(RKRLRëtmode((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRªÓscCs|jj|ƒS(s:Sets the specified host's ability to accept new instances.(R0tset_host_enabled(RKRLtenabled((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¬ÚscCs
|jjƒS(s:Returns the result of calling "uptime" on the target host.(R0tget_host_uptime(RKRL((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR®ßsc	Cs…|j||ƒ}|tjkrPtjtdƒd|d|ƒ|jj|ƒStj	ddd|j
dtj|jdd	ƒ‚d
S(s2Retrieve diagnostics for an instance on this host.sRetrieving diagnosticsRLR)tattrspower stateRIR‰Rîtget_diagnosticsN(R`RRgRGRYRR0R°RtInstanceInvalidStateR‚t	STATE_MAP(RKRLR)Ry((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR°äs		c	Cs‘|j||ƒ}|tjkr\tjtdƒd|d|ƒ|jj|ƒ}|jƒSt	j
ddd|jdtj|jdd	ƒ‚d
S(s2Retrieve diagnostics for an instance on this host.sRetrieving diagnosticsRLR)R¯spower stateRIR‰RîR°N(
R`RRgRGRYRR0tget_instance_diagnosticst	serializeRR±R‚R²(RKRLR)Rytdiags((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR³õs
		c	Cs|jƒ}|j|jd<|j||dƒtj|||jdtjj	dtj
jƒ|j||d|jƒ|j
j||ƒWdQX|j||ƒ|_tj|_d|_|jdtjƒ|j||dƒtj|||jdtjj	dtj
jƒdS(	sSuspend the given instance.RFs
suspend.startR5R6tinstance_stateNRGssuspend.end(R|R÷RpR8RgR9RëR(R:tSUSPENDR<RÈRîR0tsuspendR`RRR›R\RWRFRt
SUSPENDINGR=(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytsuspend_instances"

	c	Cs|jƒ}tjtdƒd|d|ƒ|j||dƒ|jj||ƒ}|j||ƒ}|j||d|j	ƒ|j
j||||ƒWdQX|j||ƒ|_
|jjdtjƒ|_	d|_|jdtjƒ|j||d	ƒdS(
s$Resume the given suspended instance.tResumingRLR)sresume.startR¶NRFRGs
resume.end(R|RGRYRR8RÀRRRîR÷R0tresumeR`RRpRRRSR\RWRFRtRESUMING(RKRLR)RRD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytresume_instance!s 

	cs8tjˆjƒ‡‡‡‡‡fd†ƒ}|ƒdS(s¿Shelve an instance.

        This should be used when you want to take a snapshot of the instance.
        It also adds system_metadata that can be used by a periodic task to
        offload the shelved instance after a period of time.

        :param context: request context
        :param instance: an Instance object
        :param image_id: an image id to snapshot to.
        :param clean_shutdown: give the GuestOS a chance to stop
        csˆjˆˆˆˆƒdS(N(t_shelve_instance((R¯RLRkR)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_shelve_instancePsN(RR‹R‚(RKRLR)RkR¯RÀ((R¯RLRkR)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytshelve_instance>s-cs¾tjtdƒdˆƒtj|j|ˆdtƒ|j|ˆdƒtj|ˆ|j	dt
jjdt
j
jƒtj‡fd†}|j|ˆ|ƒ|jj|ˆ||ƒtjƒjƒˆjd<|ˆjd	<|j	ˆjd
<tjˆ_dˆ_tjdkr tjˆ_n|j |ˆƒˆ_!ˆj"dtjtj#gƒ|j|ˆd
ƒtj|ˆ|j	dt
jjdt
j
j$ƒtjdkrº|j%|ˆdt&ƒndS(NtShelvingR)Rsshelve.startR5R6cs^itjtj6tjtj6tjtj6}||}||}|ˆ_ˆjd|ƒdS(NRG(RtSHELVING_IMAGE_PENDING_UPLOADRYtSHELVING_IMAGE_UPLOADINGRZtSHELVINGRWRF(RWR tshelving_state_map(R)(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR)_s



	t
shelved_atRÖtshelved_hostiRGs
shelve.endR¯('RGRYRRgR
RTRJR8R9RëR(R:tSHELVER<RÈRRÅR³R0R+RRFt	isoformatRpRtSHELVEDR÷R\RWRÕtshelved_offload_timetSHELVING_OFFLOADINGR`RRFRÄR=t_shelve_offload_instanceR²(RKRLR)RkR¯R)((R)sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¿Us8

		

cs5tjˆjƒ‡‡‡‡fd†ƒ}|ƒdS(sîRemove a shelved instance from the hypervisor.

        This frees up those resources for use by other instances, but may lead
        to slower unshelve times for this instance.  This method is used by
        volume backed instances since restoring them doesn't involve the
        potentially large download of an image.

        :param context: request context
        :param instance: nova.objects.instance.Instance
        :param clean_shutdown: give the GuestOS a chance to stop
        csˆjˆˆˆƒdS(N(RÎ((R¯RLR)RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_shelve_offload_instance“sN(RR‹R‚(RKRLR)R¯RÏ((R¯RLR)RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytshelve_offload_instanceƒs*cCs;tjtdƒd|ƒ|j||dƒ|j|||ƒ|j||ƒ}|jj|||jƒ|jj	||ƒ}|j
||ƒ}|jj||||ƒ||_
tj|_d|_|jdtjtjgƒ|j||ƒ|j|ƒ|jddƒ|j||jƒ|j||dƒdS(NsShelve offloadingR)sshelve_offload.startRGsshelve_offload.end(RGRYRR8R³R`RÀRwRëRRR0RRRtSHELVED_OFFLOADEDR÷R\RWRFRRÅRÍRñRõR?R‚(RKRLR)R¯RyRRD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRΘs.
				

csPˆdkri‰ntjˆjƒ‡‡‡‡‡‡fd†ƒ}|ƒdS(scUnshelve the instance.

        :param context: request context
        :param instance: a nova.objects.instance.Instance object
        :param image: an image to build from.  If None we assume a
            volume backed instance.
        :param filter_properties: dict containing limits, retry info etc.
        :param node: target compute node
        csˆjˆˆˆˆˆƒdS(N(t_unshelve_instance((RLRêRR)RïRK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_unshelve_instanceÐsN(R\RR‹R‚(RKRLR)RRêRïRÓ((RLRêRR)RïRKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytunshelve_instance¾s	0cCs1td|jd|jƒ}d|_t|_|S(s:Remove data from the instance that may cause side effects.tkey_datatauto_disk_configN(RcRÕRÖR\R²(RKR)tcleaned_keys((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_unshelve_instance_key_scrubÖs			cCs|j|ƒdS(s<Restore previously scrubbed keys before saving the instance.N(Rb(RKR)R”((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_unshelve_instance_key_restoreßscCsxtjtdƒd|ƒ|j||dƒtj|_|jƒtj	j
||jƒ}|j|||dt
ƒ}|j|ƒ}|dkr¼|jjƒd}tjd|d|ƒn|j|ƒ}	|jdiƒ}
|j}|r|d|_tjj|ƒ}ntjjtj|jƒƒ}|jj|||jƒ|jj||ƒ}
yN|	j|||
ƒ3|jj |||d	gd
dd|
d|ƒWdQXWn=t!k
rçt"j#ƒtj$t%d
ƒd|ƒWdQXnX|r||_|j&|||dƒn|j'||ƒ|j(||ƒt)j*|ƒ|jdtjƒ|j+||ƒ|j||dƒdS(Nt
UnshelvingR)sunshelve.startR>is#No node specified, defaulting to %sRbR9RÛRaRRDsInstance failed to spawnRGsunshelve.end(,RGRYRR8RRRRWRFR&R(R)R‚RER²RØR\R0RqRHRîRzRR‡RˆRtget_image_from_system_metadataRpRÀRRëRR†RŠR=RR>RRRÕRÙRIRgRØR­(RKRLR)RRêRïR3RDt
scrubbed_keysRíRbtshelved_image_refRR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRÒãs\
		
	
	


	
cCs-tjdd|d|ƒ|jj|ƒdS(s'Reset networking on the given instance.s
Reset networkRLR)N(RGRHR0RŸ(RKRLR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRŸscCsFtjdd|d|ƒtjd|d|ƒ|jj||ƒdS(s+Inject network info for the given instance.sInject network infoRLR)snetwork_info to inject: |%s|N(RGRHR0tinject_network_info(RKRLR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRž%s
cCs,|jj||ƒ}|j|||ƒdS(s/Inject network info, but don't return the info.N(RÀRRž(RKRLR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRÞ.scCs˜|jƒ}tjtdƒd|d|ƒ|jj||ƒ}t|ƒtjkrgtj	|ƒ}n|dk	rˆ|j||ƒ}n|jddƒS(s/Send the console output for the given instance.sGet console outputRLR)tasciitreplaceN(
R|RGRYRR0tget_console_outputRªRRštbR\t	_tail_logtdecode(RKRLR)ttail_lengthtoutput((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRá4scCs_yt|ƒ}Wntk
r)d}nX|dkr:dSdj|jdƒt|ƒƒSdS(NiRüs
(RËt
ValueErrorRÇtsplit(RKRtlength((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRãHs

cCs!|jƒ}tjdd|ƒttjƒƒ}tjjsRt	j
d|ƒ‚n|dkrwdtjj|f}n7|dkrœdtjj|f}nt	j
d|ƒ‚y+|jj||ƒ}|j||ƒ}WnAt	jk
r|jtjkr‚nt	jd|jƒ‚nX|S(s0Return connection information for a vnc console.sGetting vnc consoleR)R·tnovncs%s?token=%stxvpvncRN(R|RGRHRR‚tuuid4RÕtvncR­RtConsoleTypeUnavailabletnovncproxy_base_urltxvpvncproxy_base_urltConsoleTypeInvalidR0tget_vnc_consoletget_connection_infoRCR÷RRNtInstanceNotReady(RKRLR·R)ttokent
access_urltconsoletconnect_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRòSs$	cCsü|jƒ}tjdd|ƒttjƒƒ}tjjsRt	j
d|ƒ‚n|dkrwdtjj|f}nt	jd|ƒ‚y+|j
j||ƒ}|j||ƒ}WnAt	jk
r÷|jtjkr߂nt	jd|jƒ‚nX|S(s2Return connection information for a spice console.sGetting spice consoleR)R·sspice-html5s%s?token=%sRN(R|RGRHRR‚RìRÕtspiceR­RRîthtml5proxy_base_urlRñR0tget_spice_consoleRóRCR÷RRNRô(RKRLR·R)RõRöR÷Rø((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRûxs"	
cCsü|jƒ}tjdd|ƒttjƒƒ}tjjsRt	j
d|ƒ‚n|dkrwdtjj|f}nt	jd|ƒ‚y+|j
j||ƒ}|j||ƒ}WnAt	jk
r÷|jtjkr߂nt	jd|jƒ‚nX|S(s0Return connection information for a RDP console.sGetting RDP consoleR)R·s	rdp-html5s%s?token=%sRN(R|RGRHRR‚RìRÕtrdpR­RRîthtml5_proxy_base_urlRñR0tget_rdp_consoleRóRCR÷RRNRô(RKRLR·R)RõRöR÷Rø((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRþœs"	
cCsü|jƒ}tjdd|ƒttjƒƒ}tjjsRt	j
d|ƒ‚n|dkrwdtjj|f}nt	jd|ƒ‚y+|j
j||ƒ}|j||ƒ}WnAt	jk
r÷|jtjkr߂nt	jd|jƒ‚nX|S(s0Return connection information for a MKS console.sGetting MKS consoleR)R·twebmkss%s?token=%sRN(R|RGRHRR‚RìRÕtmksR­RRîtmksproxy_base_urlRñR0tget_mks_consoleRóRCR÷RRNRô(RKRLR·R)RõRöR÷Rø((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¾s"	
cCsÛtjdd|ƒtjjs4tjd|ƒ‚n|jƒ}tt	j
ƒƒ}dtjj|f}y+|jj
||ƒ}|j||ƒ}WnAtjk
rÖ|jtjkr¾‚ntjd|j	ƒ‚nX|S(s4Returns connection information for a serial console.sGetting serial consoleR)R·s%s?token=%sRN(RGRHRÕtserial_consoleR­RRîR|RR‚Rìtbase_urlR0tget_serial_consoleRóRCR÷RRNRô(RKRLR·R)RõRöR÷Rø((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRàscCs²|dkr$|jj||ƒ}n|dkrH|jj||ƒ}n]|dkrl|jj||ƒ}n9|dkr|jj||ƒ}n|jj||ƒ}|j|kS(Nsspice-html5s	rdp-html5tserialRÿ(R0RûRþRRRòtport(RKR¥R)RR·tconsole_info((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytvalidate_console_portscs:tjˆjƒ‡‡‡‡‡‡‡fd†ƒ}|ƒS(Ncs‰tjjˆˆjƒ}tjdˆdddddˆjdddˆdˆd	dd
ˆdˆƒ
}ˆjˆ||ƒ|_|jƒ|S(NRLtsource_typeRÎtdestination_typeRIt
boot_indexRÂR$tguest_formattdisk_bustdevice_type(	R&R(R)R‚tBlockDeviceMappingR\R(R$tcreate(R3tnew_bdm(RLtdeviceRRR)RKRÂ(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
do_reserves		
(RR‹R‚(RKRLR)RRÂRRR((RLRRRR)RKRÂsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytreserve_block_device_names3csGtjˆƒ}tj|jƒ‡‡fd†ƒ}||||ƒdS(sAttach a volume to an instance.csLyˆj|||ƒSWn.tk
rGtjƒˆjƒWdQXnXdS(N(t_attach_volumeR=RR>R(RLR)t
driver_bdm(R@RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdo_attach_volume;s


N(R.tconvert_volumeRR‹R‚(RKRLR)R@RR((R@RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt
attach_volume5s$cCs|jƒ}tjtdƒi|jd6|dd6d|d|ƒy,|j|||j|jdtdt	ƒWnqt
k
râtjƒRtj
td	ƒi|jd6|dd6d|d|ƒ|jj||jƒWdQXnXi|jd6}|j||d
d|ƒdS(Ns0Attaching volume %(volume_id)s to %(mountpoint)sRÂRt
mountpointRLR)R>tdo_driver_attachs0Failed to attach %(volume_id)s at %(mountpoint)ss
volume.attachRQ(R|RGRYRRÂtattachRÁR0R²RJR=RR>RRtunreserve_volumeR8(RKRLR)R@RY((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyREs$





 c	Cse|j}|j}tjtdƒi|d6|d6d|d|ƒyo|jj|ƒsytjtdƒd|d|ƒnt	j
||j||ƒ}|jj|||d|ƒWn­t
jk
rú}tjtdƒi|d6|d6|d	6d|ƒngtk
r`tjƒHtj
td
ƒi|d6|d6d|d|ƒ|jj||ƒWdQXnXdS(s7Do the actual driver detach using block device mapping.s2Detach volume %(volume_id)s from mountpoint %(mp)sRÂtmpRLR)s&Detaching volume from unknown instancet
encryptionsYIgnoring DiskNotFound exception while detaching volume %(volume_id)s from %(mp)s: %(err)sterrs1Failed to detach volume %(volume_id)s from %(mp)sN(R$RÂRGRYRR0RýR]RR5tget_encryption_metadataRÁRRRºR=RR>Rtroll_detaching(	RKRLR)R@R[RRÂR R!((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_driver_detach_volume[s2		




cCsqtjj|||jƒ}tjdkrNg}|j}d|krR|d}ny|jj||ƒ}Wnt	k
r~nX|rNt
jdd|ƒ|\}	}
}}}
tj|ƒ}||_
|j|_|j|_|j|_|j|_|	|_|
|_||_||_|jdtƒ|jj|dtj|ƒƒqNntj|jƒ}|jj|ƒ}tj |j kr|j!||||ƒnR|s¹t
jdd|ƒn6|rït
j"t#d	ƒi|d
6|j d6d|ƒn|rú|rú|j$dƒ|j krú|j$d
ƒ}|s\t
j%t&dƒi|j d6|j$dƒd6ƒqú|j$dƒ|j kr·t
j"t#dƒi|j d6|j$dƒd6|j$dƒd6ƒqút
jdi|j d6|j$dƒd6|j$dƒd6ƒ|}n|j'j(|||ƒ|r#|j)ƒnt*d|ƒ}|j+||dd|ƒ|j'j,|j-ƒ||j|ƒdS(s°Detach a volume from an instance.

        :param context: security context
        :param volume_id: the volume id
        :param instance: the Instance object to detach the volume from
        :param destroy_bdm: if True, the corresponding BDM entry will be marked
                            as deleted. Disabling this is useful for operations
                            like rebuild, when we don't want to destroy BDM

        is/dev/is'Updating volume usage cache with totalsR)t
update_totalssvolume.usages5Skipping _driver_detach_volume during remote rebuild.s~Unable to call for a driver detach of volume %(vol_id)s due to the instance being registered to the remote host %(inst_host)s.RÀt	inst_hostRëRÂsƒHost mismatch detected, but stashed volume connector not found. Instance host is %(ihost)s, but volume connector host is %(chost)s.tihosttchostsÇHost mismatch detected in stashed volume connector. Will use local volume connector. Instance host is %(ihost)s. Local volume connector host is %(chost)s. Stashed volume connector host is %(schost)s.tschosts²Host mismatch detected. Found usable stashed volume connector. Instance host is %(ihost)s. Local volume connector host was %(chost)s. Stashed volume connector host is %(schost)s.RÂs
volume.detachRQN(.R&Rtget_by_volume_and_instanceR‚RÕtvolume_usage_poll_intervalR$R0tblock_statsRRGRHtVolumeUsageRÂRIR$R%tavailability_zonet
curr_readstcurr_read_bytestcurr_writestcurr_write_bytesRFRJRTRYRgtusage_volume_infoRtloadsR[R·RëR$R;RRzR]RRÁR¸RRcR8R¹R|(RKRLRÂR)Rt
attachment_idR@t	vol_statsRtrd_reqtrd_bytestwr_reqtwr_bytest	flush_opst	vol_usageR[RÂtstashed_connectorRY((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR}s€
		

					




	
	
cCs|j|||d|ƒdS(s!Detach a volume from an instance.R5N(R(RKRLRÂR)R5((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRésc	Csb|jj|||ƒ}tj|dƒ}|rJd|krJ||d<n|d|d<||fS(NR[R(RÁtinitialize_connectionRR4(	RKRLt
new_volume_idt
old_volume_idRÂR)R@t	new_cinfot	old_cinfo((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_init_volume_connectionñs	
cCs÷|d}t}	d}
z>yn|j||||||ƒ\}}
tjdi|
d6|d6d|d|ƒ|jj||
|||ƒWnÉtk
rRt}	t	j
ƒ¤|
rétdƒ}tj|i|d6|d	6d
|d|ƒn:tdƒ}tj|i|d6|dd
6d
|d|ƒ|j
j||ƒ|j
j||ƒWdQXnXWd|	rc|n|}
|
r«tjdi|
d6d
|d|ƒ|j
j||
|ƒn|j
j|||d|	ƒ}tjdi|d6d
|d|ƒX||
fS(NR$seswap_volume: Calling driver volume swap with connection infos: new: %(new_cinfo)s; old: %(old_cinfo)sRARBtcontexR)s=Failed to swap volume %(old_volume_id)s for %(new_volume_id)sR@R?RLsGFailed to connect to volume %(volume_id)s with volume at %(mountpoint)sRÂRs?swap_volume: calling Cinder terminate_connection for %(volume)sRÎR;sDswap_volume: Cinder migrate_volume_completion returned: %(comp_ret)stcomp_ret(R²R\RCRGRHR0tswap_volumeR=RJRR>RRRÁR#RR¸tmigrate_volume_completion(RKRLR)R@RÂR@R?t	resize_toRR›RARBR`tconn_volumeRE((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_swap_volumeýsb
		




!	


			
cCs{|jƒ}tjj|||jƒ}|jj|ƒ}d}|jj||ƒd}|jj||ƒd}	|	|kr†|	}nt	j
tdƒi|d6|d6d|d|ƒ|j|||||||ƒ\}
}|
d}it
j|ƒd	6d
d6d
d6dd
6|d6dd6}
|r3||
d<nt	jdi|jd6|
d6d|d|ƒ|j|
ƒ|jƒdS(sSwap volume for an instance.iR½s1Swapping volume %(old_volume)s for %(new_volume)st
old_volumet
new_volumeRLR)tsave_volume_idR[RÎR
RRÔRÂt	no_devicetvolume_sizesFswap_volume: Updating volume %(volume_id)s BDM record with %(updates)stupdatesN(R|R&RR*R‚R0R·RÁRzRGRYRRJRtdumpsR\RHRÂRbRF(RKRLR@R?R)R@RÂRHtold_vol_sizetnew_vol_sizeRERARMR<((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRF9sD		



	



cCsŠyotjj|||jƒ}tj|jƒ}|j||||ƒ|jj	|ƒ}|j
j|||ƒWntj
k
r…nXdS(s0Remove a volume connection using the volume api.N(R&RR*R‚RR4R[R$R0R·RÁR¸RtNotFound(RKRLRÂR)R@R[RÂ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytremove_volume_connectionis	c
Cs¢|jjds(tjd|jƒ‚n|jj||ƒ}|jj|||||d|ƒ}t|ƒdkr®t	j
tdƒit|ƒd6ƒtjd|jƒ‚nt
jj|ƒ}y|jj|||dƒWn¹tjk
r™}	|djd	ƒ}t	jtd
ƒi|d6|	d6d
|ƒy|jj|||ƒWn4tk
r€t	jtdƒi|d6d
|ƒnXtjd|jƒ‚nX|dS(s5Use hotplug to add an network adapter to an instance.tsupports_attach_interfaceRNRis3allocate_port_for_instance returned %(ports)s portstportsRIiR9sMattach interface failed , try to deallocate port %(port_id)s, reason: %(msg)stport_idR`R)s"deallocate port %(port_id)s failed(R0ReRtAttachInterfaceNotSupportedR‚R	RÀtallocate_port_for_instanceRýRGR;RtInterfaceAttachFailedR&R‡t
from_instancetattach_interfaceRŠRzR]Rtdeallocate_port_for_instanceR=(
RKRLR)R¡RXtrequested_ipRRRRO((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR]zs:					
	c	CsE|jj}d
}x(|D] }|d|kr|}PqqW|d
kretjtdƒ|ƒ‚ny|jj||ƒWnUtjk
rÓ}t	j
tdƒi|d6|d6d|ƒtjd|j
ƒ‚nnXy|jj|||ƒWnPtk
r@}tjƒ/t	j
tdƒi|d6|d	6d|ƒWd
QXnXd
S(s*Detach a network adapter from an instance.R9sPort %s is not attacheds=Detach interface failed, port_id=%(port_id)s, reason: %(msg)sRXR`R)RIsDFailed to deallocate port %(port_id)s for instance. Error: %(error)sR;N(R¥RR\RtPortNotFoundRR0tdetach_interfaceRŠRGR]RtInterfaceDetachFailedR‚RÀR^R=RR>(RKRLR)RXRt	condemnedRRO((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRa s.

	
cCstjj||ƒS(N(R&tComputeNodet%get_first_node_by_host_for_old_compat(RKRLRë((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRëÁs	cCs|jj||ƒS(s.Check if the instance files are shared

        :param ctxt: security context
        :param instance: dict of instance data
        :param data: result of driver.check_instance_shared_storage_local

        Returns True if instance disks located on shared storage and
        False otherwise.
        (R0t$check_instance_shared_storage_remote(RKR¥R)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR!ÅscCs|j||||ƒS(sJCheck if it is possible to execute live migration.

        This runs checks on the destination host, and then calls
        back to the source host to check the results.

        :param context: security context
        :param instance: dict of instance data
        :param block_migration: if true, prepare for block migration
                                if None, calculate it in driver
        :param disk_over_commit: if true, allow disk over commit
                                 if None, ignore disk usage checking
        :returns: a dict containing migration info
        (t&_do_check_can_live_migrate_destination(RKR¥R)tblock_migrationtdisk_over_commit((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt"check_can_live_migrate_destinationÒsc	Cs¤tj|j||jƒƒ}tj|j|tjƒƒ}|jj||||||ƒ}tjd|ƒz|j	j
|||ƒ}Wd|jj||ƒX|S(Nsdestination check data is %s(RnRoRëRëRÕR0RjRGRHRÇtcheck_can_live_migrate_sourcet(cleanup_live_migration_destination_check(	RKR¥R)RhRitsrc_compute_infotdst_compute_infotdest_check_dataR*((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRgès		
cCs¤tj||ƒ}t|tjƒ}|s?tjj|ƒ}n||_|j||dtƒ}|j	j
||||ƒ}|s|jƒ}ntj
d|ƒ|S(sCheck if it is possible to execute live migration.

        This checks if the live migration can succeed, based on the
        results from check_can_live_migrate_destination.

        :param ctxt: security context
        :param instance: dict of instance data
        :param dest_check_data: result of check_can_live_migrate_destination
        :returns: a dict containing migration info
        R]ssource check data is %s(Rgtis_volume_backed_instanceRBtmigrate_data_objtLiveMigrateDatatdetect_implementationtis_volume_backedRR²R0Rktto_legacy_dictRGRH(RKR¥R)RoRttgot_migrate_data_objectRDR•((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRküs"					c	Cs:tjd|ƒt|tjƒ}|s=tjj|ƒ}n|j||dtƒ}|jj	||ƒ}|j
||dd|ƒ|jj||||||ƒ}tjd|ƒ|jj
|||jƒ|jj||ƒ|j
||dd|ƒ|r&|r&|jdtƒ}|d}ntjd	|ƒ|S(
sŽPreparations for live migration at dest host.

        :param context: security context
        :param instance: dict of instance data
        :param block_migration: if true, prepare for block migration
        :param migrate_data: A dict or LiveMigrateData object holding data
                             required for live migration without shared
                             storage.

        spre_live_migration data is %sR]slive_migration.pre.startRs$driver pre_live_migration data is %sslive_migration.pre.endtpre_migration_resulttpre_live_migration_results$pre_live_migration result data is %s(RGRHRBRqRrRsRRJRÀRR8R0tpre_live_migrationRRëRxRu(	RKRLR)RhtdiskR*RvRDR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRys@		

		
c

CsÈ|j|dƒt|tjƒ}|s=tjj|ƒ}nymd|kr‚|jr‚|j||ƒ}|jj|d|ƒ}	nd}	|j
j||||	||ƒ}Wnitk
rt
jƒJtjtdƒ|d|ƒ|j|dƒ|j|||||ƒWdQXnX|j|dƒ|r8||_ntjd|ƒy,|jj||||j|j||ƒWnMtk
rÃtjtd	ƒd|ƒt
jƒ|j|dƒWdQXnXdS(
Nt	preparingRhRDsPre live migration failed at %sR)R;Rslive_migration data is %ssLive migration failed.(RáRBRqRrRsRhRR0tget_instance_disk_infoR\RÇRyR=RR>RGRRt_rollback_live_migrationR9RHtlive_migrationt_post_live_migration(
RKRLtdestR)RhR9R*RvRDRz((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_do_live_migration`sJ				




csBˆj|dƒ‡fd†}tj|||||||ƒdS(spExecuting live migration.

        :param context: security context
        :param dest: destination host
        :param instance: a nova.objects.instance.Instance object
        :param block_migration: if true, prepare for block migration
        :param migration: an nova.objects.Migration object
        :param migrate_data: implementation specific params

        tqueuedcs$ˆjˆj||ŽWdQXdS(N(RâR(RMRN(RK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytdispatch_live_migration§s
N(RáRR`(RKRLR€R)RhR9R*Rƒ((RKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR~–s		cCs:|j||dƒ|jj|ƒ|j||dƒdS(sForce live migration to complete.

        :param context: Security context
        :param instance: The instance that is being migrated
        :param migration_id: ID of ongoing migration; is currently not used,
        and isn't removed for backward compatibility
        s#live.migration.force.complete.starts!live.migration.force.complete.endN(R8R0tlive_migration_force_complete(RKRLR)Ra((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR„¶s


c	Cs‹tjj||ƒ}|jdkrQtjd|d|jd|jddƒ‚n|j||dƒ|jj	|ƒ|j||dƒd	S(
sÓAbort an in-progress live migration.

        :param context: Security context
        :param instance: The instance that is being migrated
        :param migration_id: ID of in-progress live migration

        RRaRIR‰Rîsabort live migrationslive.migration.abort.startslive.migration.abort.endN(
R&R{R^RDRtInvalidMigrationStateR‚R8R0tlive_migration_abort(RKRLR)RaR9((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR†És		
cCs›t}t}t|tjƒr3|j}|j}nPt|tjƒr\|j}|j}n't|tjƒrƒ|j}|j}n|}|}||fS(s^Determine whether disks or instance path need to be cleaned up after
        live migration (at source on success, at destination on rollback)

        Block migration needs empty image at destination host before migration
        starts, so if any failure occurs, any empty images has to be deleted.

        Also Volume backed live migration w/o shared storage needs to delete
        newly created instance-xxx dir on the destination as a part of its
        rollback process

        :param migrate_data: implementation specific data
        :returns: (bool, bool) -- do_cleanup, destroy_disks
        (	RJRBRqtLibvirtLiveMigrateDatatis_shared_block_storagetis_shared_instance_pathtXenapiLiveMigrateDataRhtHyperVLiveMigrateData(RKR*RˆR‰t
do_cleanupR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_live_migration_cleanup_flagsás	

	c
Cs¬tjtdƒd|ƒtjj||jƒ}|j||d|ƒ}|jj	||||ƒ|jj
|ƒ}x3|D]+}	|	jr{|jj
||	j|ƒq{q{W|jj||ƒ}
|j||dd|
ƒtjdd|ƒ|jj||
ƒi|jd6|d6}|jj|||ƒt}y|jj|||
ƒWn,tk
ry}
tj|
d|ƒt}nX|jj||||ƒ|j|ƒ\}}|rìtjd	d|ƒ|jj|||
d
|d|d|ƒn|jj|ƒ|j |ƒ|j!||ƒ|j||d
d|
ƒtjtdƒ|d|ƒtjtdƒd|ƒ|j"||ƒ|r¨|j#dƒr¨d|j$_%|j$j&ƒndS(sÇPost operations for live migration.

        This method is called from live_migration
        and mainly updating database record.

        :param ctxt: security context
        :param instance: instance dict
        :param dest: destination host
        :param block_migration: if true, prepare for block migration
        :param migrate_data: if not None, it is a dict which has data
        required for live migration without shared storage

        s#_post_live_migration() is started..R)R3slive_migration._post.startRs:Calling driver.unfilter_instance from _post_live_migrationRRws0Calling driver.cleanup from _post_live_migrationRR*tdestroy_vifsslive_migration._post.ends/Migrating instance to %s finished successfully.s~You may see the error "libvirt: QEMU error: Domain not found: no domain with matching name." This error can be safely ignored.R9R¬N('RGRYRR&R(R)R‚RR0tpost_live_migrationR·R´RÁR¸RÂRÀRR8RHtunfilter_instanceRëRpR²tpost_live_migration_at_sourceRRJRÇt"post_live_migration_at_destinationRtcleanupR‡R˜R¯R­R>RýR9RDRF(RKR¥R)R€RhR*R3RDRÂR@RR9RŽRORŒR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRst	
	






cCs:tjjp9tjjp9tjjp9tjjp9tjjS(s$Returns whether a console is enable.(RÕRíR­RùRüRR(RK((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_consoles_enabledvscCsN|jƒrJtjjr1|jj||jƒqJ|jj||jƒndS(s,Clean console tokens stored for an instance.N(	R”RÕtcellstenableRÏtconsoleauth_delete_tokensR‚RÎtdelete_tokens_for_instance(RKR¥R)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR>|s		c	Cs&tjtdƒd|ƒ|jj|||jƒi|jd6|jd6}|jj|||ƒ|jj||ƒ}|j||dd|ƒ|j	||ƒ}zpy |j
j|||||ƒWnItk
rt
jƒ*tj|_tjtdƒd|ƒWdQXnXWd|j||ƒ}d}|j}	zVy"|j||jƒ}
|
j}Wn-tjk
rŠtjtd	ƒ|jƒnXWd|j|_||_d|_||_d
|_|jdtj ƒXX|jj|||	dt!ƒ|jj|||jƒ|j||d
d|ƒdS(sÄPost operations for live migration .

        :param context: security context
        :param instance: Instance dict
        :param block_migration: if true, prepare for block migration

        s#Post operation of migration startedR)RRwslive_migration.post.dest.startRs@Unexpected error during post live migration at destination host.Ns!Failed to get compute_info for %siRGRdslive_migration.post.dest.end("RGRYRRÀRRëRxRR8RR0R’R=RR>RRöR÷R;RR`R\RëRìRRíRRWRïR
RFRRuRJ(RKRLR)RhR9RRDRyt	node_namet	prev_hostR÷((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR’†s^


			

	
				
R;c	Csud|_d|_|jdtjgƒt|tƒr^|jddƒ}t	j
j|ƒ}n3t|t	j
ƒr‹|jdƒr‹|j
}nd}|jj|||jƒtjj||jƒ}x6|D].}	|	jrÉ|jj|||	j|ƒqÉqÉW|j||dƒ|j|ƒ\}
}|
rN|jj|||d|d|ƒn|j||dƒ|j||ƒdS(	s?Recovers Instance/volume state from migrating -> running.

        :param context: security context
        :param instance: nova.objects.instance.Instance object
        :param dest:
            This method is called from live migration src host.
            This param specifies destination host.
        :param block_migration: if true, prepare for block migration
        :param migrate_data:
            if not none, contains implementation specific data.
        :param migration_status:
            Contains the status we want to set for the migration object

        iRGR9slive_migration._rollback.startRR*slive_migration._rollback.endN(R\RWR
RFRRuRBRcRRqRrRsRýR9RÀRRëR&R(R)R‚R´RÇRURÂR8Rt&rollback_live_migration_at_destinationRá(RKRLR)R€RhR*tmigration_statusR9R3R@RŒR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR}Ís:				
			
cCs|jj||ƒ}|j||dd|ƒzgy#|jj|||jdtƒWn=tk
r“tjƒt	j
tdƒd|ƒWdQXnXWd|j||ƒ}t
|tƒrÎtjj|ƒ}n|jj||||d|d|ƒX|j||d	d|ƒdS(
sÁCleaning up image directory that is created pre_live_migration.

        :param context: security context
        :param instance: a nova.objects.instance.Instance object sent over rpc
        s"live_migration.rollback.dest.startRRds-An error occurred while deallocating network.R)NRR*s live_migration.rollback.dest.end(RÀRR8RRëRJR=RR>RGRRRRBRcRqRrRsR0R›(RKRLR)RR*RRD((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR›s0

				cCs{tj}|sdSt|dgƒ}d}tjdƒ|stjdƒtjj||j	dgdt
ƒ}x„|D]|}|jtj
kr§tjdd|ƒqvn|jtjkrÒtjd	d|ƒqvn|sá|}qv|j|d
ƒqvW||_nµx²|r¶y7tjj||jdƒddd
dgdt
ƒ}Wntjk
r[qnX|j	|j	kr„tjdd|ƒq|jtjkr¬tjd	d|ƒq|}PqW|rjy*|jj||ƒtjdd|ƒWqwtjk
rtjdd|ƒdStjk
r7tjdd|ƒqwtk
rftjtdƒd|dt
ƒqwXn
tjdƒdS(sÜCalled periodically.  On every call, try to update the
        info_cache's network information for another instance by
        calling to the network manager.

        This is implemented by keeping a cache of uuids of instances
        that live on this host.  On each call, we pop one off of a
        list, pull the DB record, and try the call to the network API.
        If anything errors don't fail, as it's possible the instance
        has been deleted, etc.
        Nt_instance_uuids_to_heals!Starting heal instance info caches(Rebuilding the list of instances to healRqRúsBSkipping network cache update for instance because it is Building.R)sGSkipping network cache update for instance because it is being deleted.R‚iRpR¥R.sXSkipping network cache update for instance because it has been migrated to another host.s+Updated the network info_cache for instances,Instance no longer exists. Unable to refreshs5InstanceInfoCache no longer exists. Unable to refreshs5An error occurred while refreshing the network cache.R<s8Didn't find any instances for network info cache update.(RÕt!heal_instance_info_cache_intervaltgetattrR\RGRHR&RþR©RëRJR÷RRNRWRRLRRRrR’RRRCRÀRtInstanceInfoCacheNotFoundR=R;R(RKRLt
heal_intervaltinstance_uuidsR)tdb_instancesR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_heal_instance_info_cache9sp
	

	
				




cCsµtjdkr±itjtjtjgd6|jd6}tjj	||dgdt
ƒ}g}x6|D].}tj|j
tjƒrf|j|ƒqfqfW|jjtj|ƒndS(NiRWRëRqRú(RÕtreboot_timeoutRRdRbRcRëR&RþRÿRJRRùR RR0tpoll_rebooting_instances(RKRLRt	rebootingtto_pollR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_rebooting_instancesœs

	
cCs·tjdkr³itjd6|jd6}tjj||ddgdtƒ}g}x6|D].}t	j
|jtjƒrZ|j|ƒqZqZWx$|D]}|j
j||ƒq“WndS(NiR÷RëRqRpRú(RÕtrescue_timeoutRRRëR&RþRÿRJRRùRGRRÆRV(RKRLRtrescued_instancestto_unrescueR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_rescued_instances¯s

		

cCs‰tjdkrdStjj|tj|jdtƒ}tdt|ƒdtjƒ}|ddkr~t	j
tdƒ|ƒnd„}xû|D]ó}|j}t	j
tdƒi|j
d6|d	6ƒd
dg}y%tjj||d|dtƒ}Wn4tjk
r+td
ƒ|}	|||	ƒqŽnX|jtjkrctdƒ}	|||	d|ƒqŽn|jtjtjgkrd}
t	j|
d|ƒqŽn|jtjkrÎd}
t	j|
d|ƒqŽn|j}|j}|tjksû|dk	r2tdƒi|d6|d6}	|||	d|ƒqŽny|jj||d|ƒWqŽt k
r€}
t	j
tdƒ|
d|ƒqŽXqŽWdS(NiRútmigration_counttconfirm_windowsVFound %(migration_count)d unconfirmed migrations older than %(confirm_window)d secondsc[sUtjtdƒi|dd6|d6|d|_|jƒ|jƒWdQXdS(Ns7Setting migration %(migration_id)s to error: %(reason)sR9RaRàR;(RGR]RRDRERF(R9RàRN((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_set_migration_to_errorÒs	
sRAutomatically confirming migration %(migration_id)s for instance %(instance_uuid)sRaRIRoRpRqsInstance %s not foundsIn ERROR stateR)sLInstance being deleted or soft deleted during resize confirmation. Skipping.s=Instance still resizing during resize confirmation. Skipping.s7In states %(vm_state)s/%(task_state)s, not RESIZED/NoneR÷RWR9s3Error auto-confirming resize: %s. Will retry later.(!RÕtresize_confirm_windowR&Rtget_unconfirmed_by_dest_computeRëRJRcRýRGRYRRIR9RrR’RRCRR÷RRöRWRRLRÛRHR™R›R\RÆRcR=(RKRLt
migrationstmigrations_infoR°R9RIRqR)RàR`R÷RWR^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_unconfirmed_resizesÁsn		
		
	

	
			
cCs+tjdkrdSitjd6dd6|jd6}tjj|d|ddgdt	ƒ}g}xO|D]G}|j
}tj|d	ƒ}tj
|tjƒrh|j|ƒqhqhWxq|D]i}y6tj|_|jd
dƒ|j||dtƒWqºtk
r"tjtdƒd
|ƒqºXqºWdS(NiR÷RWRëRRqRpRúRÇRGR¯s)Periodic task failed to offload instance.R)(N(RÕRÌRRËR\RëR&RþRÿRJRpRt
parse_strtimeRùRRRÍRWRFRÐR²R=RGRR(RKRLRtshelved_instancestto_gcR)tsys_metaRÇ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_shelved_instancess.

		
	

cCsÚtjs
dStjƒ\}}tjj|d|||jƒrDdStjj	|||d|jdddddgdt
ƒ}t|ƒ}d	}d	}tj
td
ƒi|jd6|d6|d6|d
6ƒtjƒ}tj|ƒ}	d|	_||	_||	_|j|	_||	_d|	_|	jƒxu|D]m}
y*tj|j||
dtƒ|d7}Wq/tk
r›tjtdƒ|jd|
ƒ|d7}q/Xq/W||	_d|j|tjƒ|f|	_|	jƒdS(Ntinstance_usage_auditRëRqRpR¥RoR.RúissRunning instance usage audit for host %(host)s from %(begin_time)s to %(end_time)s. %(number_instances)s instances.t
begin_timetend_timetnumber_instancessInstance usage audit started...tignore_missing_network_datais6Failed to generate usage audit for instance on host %sR)sAInstance usage audit ran for host %s, %s instances in %s seconds.(RÕR»Rtlast_completed_audit_periodR&tTaskLogRzRëRþtget_active_by_window_joinedRJRýRGRYRRÆt	task_nametperiod_beginningt
period_endingt
task_itemsR…t
begin_taskRgR
RTR²R=RRterrorstend_task(RKRLtbegintendRt
num_instancesRÈt	successest
start_timettask_logR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_instance_usage_audit5sV					
					


		 cCs¼|js
dStjƒ\}}tjƒ}||jtjkr¸||_tjt	dƒƒtj
j}|dkrš||j|krš||_t
}nt}tjj||jdt
ƒ}y|jj|ƒ}Wn.tk
rtjt	dƒƒt|_dSXtjƒ}	x¤|D]™}
tjdƒd}d}d}
d}tjj||
d|
dd|dt
ƒ}|rœ|j}|j}|j}
|j }nGtjj||
d|
dd|dt
ƒ}|rã|j}
|j }n|
dk	r%|
d|
kr||
d7}q%||
d|
7}n|dk	rg|
d	|krR||
d	7}qg||
d	|7}ntjd
|ƒj!|
d|
d|||
d|
d	d|d|	d|ƒqWndS(
NsUpdating bandwidth usage cacheiRús,Bandwidth usage not supported by hypervisor.R‚tmac_addresststart_periodtbw_intbw_outRLtlast_refreshedtupdate_cells("RÄRRÀRÆRÃRÕtbandwidth_poll_intervalRGRYRR•tbandwidth_update_intervalRÅRJR²R&RþR©RëR0tget_all_bw_countersRRRFRRÈR\tBandwidthUsagetget_by_instance_uuid_and_macRÓRÔtlast_ctr_intlast_ctr_outR(RKRLt	prev_timeRÎt	curr_timetcells_update_intervalRÖRtbw_counterst	refreshedtbw_ctrRÓRÔRÜRÝtusage((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_bandwidth_usagejs~	
	
					
	

						
c	Cs•g}tjj||jd|ƒ}xj|D]b}tjj||jd|ƒ}g|D]}|jrV|^qV}|jt	d|d|ƒƒq+W|S(s3Return all block device mappings on a compute host.RúR)t
instance_bdms(
R&RþR©RëR(R)R‚R´RRc(	RKRLRútcompute_host_bdmsRR)R3R@Ræ((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_get_host_volume_bdmsÃs	
	"cCsÛxÔ|D]Ì}tjdƒtj|ƒ}|d|_|dj|_|dj|_|dj|_|dj	|_	|d|_
|d|_|d|_|d|_
|jƒ|jj|dtj|ƒƒqWd	S(
s:Updates the volume usage cache table with a list of stats.iRÎR)R7R8R9R:svolume.usageN(RRÈR&R-RÂR‚RIR$R%R.R/R0R1R2RFRTRYRgR3(RKRLt
vol_usagesRäR<((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_update_volume_usage_cacheÑs







cCstjdkrdS|j|dtƒ}|s2dStjdƒy|jj||ƒ}Wntk
rldSX|j	||ƒdS(NiRúsUpdating volume usage cache(
RÕR+RèRJRGRHR0tget_all_volume_usageRRê(RKRLRçRé((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_poll_volume_usageäs	


trun_immediatelycsötjjˆˆjdgdtƒ}ˆjjƒ}t|ƒ}||krrtj	t
dƒi|d6|d6ƒn‡‡fd†}xk|D]c}|j}|ˆjkr½tj
d|ƒq‹tj
d|ƒtˆj|<ˆjj||ƒq‹Wd	S(
s«Align power states between the database and the hypervisor.

        To sync power state data we make a DB call to get the number of
        virtual machines known by the hypervisor and if the number matches the
        number of virtual machines known by the database, we proceed in a lazy
        loop, one database record at a time, checking if the hypervisor has the
        same power state as is in the database.
        RqRús•While synchronizing instance power states, found %(num_db_instances)s instances in the database and %(num_vm_instances)s instances on the hypervisor.tnum_db_instancestnum_vm_instancescsvtjˆjƒ‡‡‡fd†ƒ}y|ƒWn*tk
r^tjtdƒdˆƒnXˆjjˆjƒdS(NcsˆjˆˆƒdS(N(t"_query_driver_power_state_and_sync((RLtdb_instanceRK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt!query_driver_power_state_and_syncssIPeriodic sync_power_state task had an error while processing an instance.R)(	RR‹R‚R=RGRRRØR(RñRò(RLRK(RñsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_syncs'
sSync already in progress for %ssTriggering sync for uuid %sN(R&RþR©RëRJR0tget_num_instancesRýRGR]RR‚RØRHR×R`(RKRLR£RïRîRóRñR‚((RLRKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_sync_power_states÷s"	

	
cCs°|jdk	r9tjtdƒi|jd6d|ƒdSy|jj|ƒ}|j}Wntj	k
rwt
j}nXy|j|||dt
ƒWntj	k
r«nXdS(NsIDuring sync_power_state the instance has a pending task (%(task)s). Skip.ttaskR)Rú(RWR\RGRYRR0R±R‰RRCRR²RœRJ(RKRLRñtvm_instanceR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRð-s 

	cCsE|jd|ƒ|j}|j}|j|jkrhtjtdƒi|jd6|jd6d|ƒdS|jdk	r¡tjtdƒi|jd6d|ƒdS|}||krùtjtd	ƒi|d
6|d6d|ƒ||_|j	ƒ|}n|t
jt
jt
j
t
jt
jfkr&n|t
jkr¶|tjtjfkrîtjtdƒi|d
6|jd6|d
6|d6d|ƒy6|jrª|jj||ƒn|jj||ƒWq³tk
rêtjtdƒd|ƒq³XqA|tjkr]tjtdƒd|ƒy|jj||ƒWq³tk
rYtjtdƒd|ƒq³XqA|tjkrˆtjtdƒd|ƒqA|tjkrAtjtdƒd|ƒqAn‹|t
jkrh|tjtjtjfkrAtjtdƒi|d
6|jd6|d
6|d6d|ƒy|jj||ƒWqetk
ratjtdƒd|ƒqeXqAnÙ|t
jkrò|tjtjfkrAtjtdƒd|ƒy|jj||ƒWqïtk
rëtjtdƒd|ƒqïXqAnO|t
j t
j!fkrA|tjtjfkrAtjtdƒd|ƒqAndS(sÓAlign instance power state between the database and hypervisor.

        If the instance is not found on the hypervisor, but is in the database,
        then a stop() API will be called on the instance.
        RúsVDuring the sync_power process the instance has moved from host %(src)s to host %(dst)stsrctdstR)NsIDuring sync_power_state the instance has a pending task (%(task)s). Skip.RösÍDuring _sync_instance_power_state the DB power_state (%(db_power_state)s) does not match the vm_power_state from the hypervisor (%(vm_power_state)s). Updating power_state in the DB to match the hypervisor.RŒRsÎInstance shutdown by itself. Calling the stop API. Current vm_state: %(vm_state)s, current task_state: %(task_state)s, original DB power_state: %(db_power_state)s, current VM power_state: %(vm_power_state)sR÷RWs(error during stop() in sync_power_state.s9Instance is suspended unexpectedly. Calling the stop API.s(Instance is paused unexpectedly. Ignore.s+Instance is unexpectedly not found. Ignore.sÊInstance is not stopped. Calling the stop API. Current vm_state: %(vm_state)s, current task_state: %(task_state)s, original DB power_state: %(db_power_state)s, current VM power_state: %(vm_power_state)ss9Paused instance shutdown by itself. Calling the stop API.sInstance is not (soft-)deleted.("RlRR÷RëRGRYRRWR\RFRRNRR›R›RöRSR–RÏR]Rtshutdown_terminateRÆRmtstopR=RRRkR²RTt
force_stopRJRM(RKRLRñRRúRŒR÷torig_db_power_state((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRœEs´
		



	
			


	



	



	
		c	Cs*tj}|dkr&tjdƒdStjj|dƒ}itj	d6dd6|j
d6}tjj||dtj
jdtƒ}x |D]˜}|j||ƒrŠtjj||jƒ}tjtd	ƒd
|ƒy|j||||ƒWq"tk
r}tjtdƒ|d
|ƒq"XqŠqŠWdS(s/Reclaim instances that are queued for deletion.is0CONF.reclaim_instance_interval <= 0, skipping...NR÷RWRëRqRúsReclaiming deleted instanceR)s.Periodic reclaim failed to delete instance: %s(RÕtreclaim_instance_intervalRGRHR&R*RÌR\RRJRëRþRÿR)tINSTANCE_DEFAULT_FIELDSRJt_deleted_old_enoughR(R)R‚RYRR_R=R]R(	RKRLtintervalR+RRR)R3R^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_reclaim_queued_deletesès,	


			
	cCsŸ|j|ƒ}y|j|ƒWnktjk
r`tjtdƒ|ƒ|jj|dƒdSt
k
rtjtdƒi|d6ƒnX||j|<dS(Ns9Compute node '%s' not found in update_available_resource.s+Error updating resources for node %(node)s.Rï(RîR¯RRíRGRYRRÓRR\R=R(RKRLRìRí((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt"update_available_resource_for_nodes
cs·|j|dtƒ}t|jjƒƒ‰xˆD]}|j||ƒq1W‡fd†|jjƒDƒ|_xC|D];}|jˆkrtt	j
tdƒ|jƒ|j
ƒqtqtWdS(sôSee driver.get_available_resource()

        Periodic process that keeps that the compute host's understanding of
        resource availability and usage in sync with the underlying hypervisor.

        :param context: security context
        Rúcs+i|]!\}}|ˆkr||“qS(((RûRóRô(t	nodenames(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pys
<dictcomp>6s		sDeleting orphan compute node %sN(t_get_compute_nodes_in_dbRJtsetR0RqRRÓRžRìRGRYRR9R(RKRLtcompute_nodes_in_dbRìtcn((RsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR¯%s
	
"
cCsUy tjj||jd|ƒSWn.tjk
rPtjtdƒ|jƒgSXdS(NRús"No compute node record for host %s(	R&tComputeNodeListtget_all_by_hostRëRRTRGR;R(RKRLRú((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR?scCstj}|dkrdStj|ddƒ×xÏ|j|ƒD]¾}|dkrstjtdƒ|jd|ƒq?|dkr&tj	t
d	ƒ|jd|ƒyLy|jj|t
ƒWntk
rØtjd
ƒnX|jj|ƒWqýtk
r"tdƒ}tj|d|dtƒqýXq?|d
krçtj	t
dƒ|jd|ƒtjj||jdtƒ}|jj|ƒy3|j|||dt
ƒ|j||j|ƒWqýtk
rã}tjtdƒ|d|ƒqýXq?ttdƒ|ƒ‚q?WWdQXdS(sÍCleanup any instances which are erroneously still running after
        having been deleted.

        Valid actions to take are:

            1. noop - do nothing
            2. log - log which instances are erroneously running
            3. reap - shutdown and cleanup any erroneously running instances
            4. shutdown - power off *and disable* any erroneously running
                          instances

        The use-case for this cleanup task is: for various reasons, it may be
        possible for the database to show an instance as deleted but for that
        instance to still be running on a host machine (see bug
        https://bugs.launchpad.net/nova/+bug/911366).

        This cleanup task is a cross-hypervisor utility for finding these
        zombied instances and either logging the discrepancy (likely what you
        should do in production), or automatically reaping the instances (more
        appropriate for dev environments).
        tnoopNRŠR‹Rs\Detected instance with name label '%s' which is marked as DELETED but still present on host.R)tshutdowns`Powering off instance with name label '%s' which is marked as DELETED but still present on host.s6set_bootable is not implemented for the current driversFailed to power off instanceR<treaps^Destroying instance with name label '%s' which is marked as DELETED but still present on host.RúRÀs.Periodic cleanup failed to delete instance: %ss@Unrecognized value '%s' for CONF.running_deleted_instance_action(RÕtrunning_deleted_instance_actionRttemporary_mutationt_running_deleted_instancesRGR]RRšRYRR0tset_bootableR²RRHR²R=RJR&R(R)R‚R‡R˜R¤R{R(RKRLR5R)R`R3R^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt"_cleanup_running_deleted_instancesGsF	

 	cCsbtj}itd6td6|jd6}|j||ƒ}g|D]}|j||ƒr@|^q@S(spReturns a list of instances nova thinks is deleted,
        but the hypervisor thinks is still running.
        Rtsoft_deletedRë(RÕt running_deleted_instance_timeoutRJR²RëR
R(RKRLR¯RRR=((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR”s	

cCs;|j}|r$|jddƒ}n|p:tj||ƒS(Nttzinfo(t
deleted_atRàR\RRù(RKR)R¯R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRŸs	ccsc|j}y	dVWnJtk
r“}tjƒ^|rD|jƒntjtdƒi|d6|d6d|ƒ|j||d|ddƒWdQXnÌt
jk
rÿ}|r¸|jƒntjtdƒ|d|ƒ|j||dtj
ddƒ|j‚n`tk
r^tj
tdƒd|ƒtjƒ(|rE|jƒn|j||ƒWdQXnXdS(	Ns3Setting instance back to %(state)s after: %(error)sR‰R;RIR÷RWs)Setting instance back to ACTIVE after: %ss"Setting instance vm_state to ERROR(R‚RRR>RÆRGRYRR[R\RtInstanceFaultRollbackRRStinner_exceptionR=RRù(RKRLR)R+R¶RIR;((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyRî¥s:		



	


c	Cs‡y |jj|||d|ƒWn`tk
r@tjdƒnCtjk
r‚tjƒ!|jj	||j
||ƒWdQXnXdS(s3Notify hypervisor of change (for hypervisor pools).t
slave_infos5Hypervisor driver does not support add_aggregate_hostN(R0tadd_to_aggregateRRGRHRtAggregateErrorRR>tundo_aggregate_operationtdelete_host(RKRLt	aggregateRëR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytadd_aggregate_hostÈs

	cCs¡y |jj|||d|ƒWnztk
r@tjdƒn]tjtjfk
rœ}tj	ƒ0|jj
||j||t|tjƒƒWdQXnXdS(s/Removes a host from a physical hypervisor pool.Rs8Hypervisor driver does not support remove_aggregate_hostN(
R0tremove_from_aggregateRRGRHRRtInvalidAggregateActionRR>Rtadd_hostRB(RKRLRëRRR^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytremove_aggregate_hostØs

	cCsO|jj||ƒ}|rKtjdi|jd6d|ƒ|j|ƒndS(NsProcessing event %(event)sR1R)(R‡R–RGRHRŽR¡(RKR)R1R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_process_instance_eventês
	cCså|jj}xÒt|ƒD]Ä\}}|d|krtjtdƒi|dd6d|ƒ||=tj|j||d|ƒy|j	j
||ƒWn@tjk
rØ}tj
tdƒi|d6|d6d|ƒnXPqqWdS(	NR9sfNeutron deleted interface %(intf)s; detaching it from the instance and deleting it from the info cachetintfR)tnw_infos=Detach interface failed, port_id=%(port_id)s, reason: %(msg)sRXR`(R¥Rt	enumerateRGRYRtbase_net_apit"update_instance_cache_with_nw_infoRÀR0RaRRŠR]R(RKRLR)tdeleted_vif_idRtindexRRO((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt#_process_instance_vif_deleted_eventñs$	cCsx
|D]}g|D]}|j|jkr|^qd}tjdi|jd6d|ƒ|jdkrÔy|jj||ƒWqtj	k
rÐ}tj
tdƒi|jd6tj
|ƒd6d|ƒqXq|jdkrü|j|||jƒq|j||ƒqWdS(	NisReceived event %(event)sR1R)snetwork-changedsEFailed to process external instance event %(event)s due to: %(error)sR;snetwork-vif-deleted(R‚RIRGRHRŽRšRÀRRRTRYRRRšR,RœR$(RKRLRRR1RR)R^((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytexternal_instance_events$

"	 	
texternal_process_okcCs|jjdsdStjtjtjƒtjtjƒ}itd6t	d6|d6}t
jj||dgdt	ƒ}|jj
||ƒdS(s-Run a single pass of the image cache manager.thas_imagecacheNRRRëRqRú(R0ReR2tregister_storage_useRÕtinstances_pathRëtget_storage_usersR²RJR&RþRÿtmanage_image_cache(RKRLtnodesRtfiltered_instances((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_run_image_cache_manager_pass's

cCs^tjdƒitd6td6tjd6td6}dddg}tj|d	d
ƒ&tj	j
||d|dtƒ}Wd
QXtjdt|ƒƒxÃ|D]»}t|j
jddƒƒ}tjdi|d6tjd6d|ƒ|tjkr›|jj|ƒ}t|dƒ|j
d<|r-t|_ntj|d	d
ƒ|jƒWd
QXq›q›Wd
S(s(Retry any pending instance file deletes.sCleaning up deleted instancesRRRëtcleanedR¥RRpRŠR‹RqRúNsThere are %d instances to cleantclean_attemptst0s9Instance has had %(attempts)s of %(max)s cleanup attemptsRÄRàR)i(RGRHRJR²RÕRëRRR&RþRÿRýRËRpRzt maximum_instance_delete_attemptsR0tdelete_instance_filesRR7RF(RKRLRtattrsRR)RÄtsuccess((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_run_pending_deletes@s.



	
	

c
Cs“tjdƒitjd6dd6}tjj||ƒ}|sCdStg|D]}|j^qMƒ}it	d6t
d6|d6}d	d
dg}tj|dd
ƒ&tj
j||d|dt	ƒ}WdQXxÀ|D]¸}	|	jtjkrÓx|D]’}|	j|jkrò|jj|	ƒy*d|_|jƒ|jƒWdQXWn9tjk
rtjtdƒ|jd|d|	ƒnXPqòqòWqÓqÓWdS(sDelete instance files on failed resize/revert-resize operation

        During resize/revert-resize operation, if that instance gets deleted
        in-between then instance files might remain either on source or
        destination compute node because of race condition.
        s8Cleaning up deleted instances with incomplete migration RëR;RDNRRR‚R¥RRpRŠR‹RqRúR›sMigration %s is not found.RLR)(RGRHRÕRëR&RRÿRRIRJR²RRRþR‚R0R;RDRERFRR_R]RR9(
RKRLtmigration_filtersR³R9tinst_uuid_from_migrationstinst_filtersR<RR)((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_cleanup_incomplete_migrations^s:


	
	

	
cCs8|jƒ}tjj|ƒ}|jj|||ƒdS(s!Quiesce an instance on this host.N(R|R&R‡R\R0tquiesce(RKRLR)R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytquiesce_instance‹scsgx`|D]X‰ˆjdƒdkr‡‡‡fd†}tj|ƒ}|jddƒjƒqqWdS(NR
R+csAˆjjˆˆdƒ}|jdƒdkr=tjƒ‚ndS(NRÔRDR½(RÁtget_snapshotRzRtLoopingCallDone(R+(RLtmapping_dictRK(sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_wait_snapshotšs	Rgà?(RzRtFixedIntervalLoopingCallRÌR±(RKRLR:RHRY((RLRGRKsI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt_wait_for_snapshots_completion–s

cCs‡|jƒ}|r[y|j||ƒWq[tk
rW}tjtdƒ|d|ƒq[Xntjj|ƒ}|j	j
|||ƒdS(s¡Unquiesce an instance on this host.

        If snapshots' image mapping is provided, it waits until snapshots are
        completed before unqueiscing.
        s:Exception while waiting completion of volume snapshots: %sR)N(R|RJR=RGRRR&R‡R\R0t	unquiesce(RKRLR)R:R;R((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pytunquiesce_instance£s(úR¥R¦t__doc__t	messagingtTargetttargetR®R\R€RèRîRñR[RõR²RùR
RRR4R1RBR€RaRRŸR¤R¨R®R°R`Rµtwrap_exceptionR¶R¸R}RºRÏRÜRëRìR÷RRüRÿRRRRR#R(R5R;R=RJRERIR­R?RÕt scheduler_instance_sync_intervalRPR8RZRRaRjRcRiRtadd_hookRR^RvRrR¹RºR‰RsR¨R±R³R¤R{R_RÎRnRÑRÕRptexpected_exceptionsRRtTriggerCrashDumpNotSupportedtInstanceNotRunningRÙRÜRàR§RáRèRâRùRïRþRúRRfRnR#R'R(R!R\R0R2R$RARFRKRTRXRYRcR`RVRuRsR„RŠR‰R€RqRvRœR’RR¢R¦RlR©RªR¬R®R°R³RºR¾RÁR¿RÐRÎRÔRØRÙRÒRŸRžRÞtConsoleNotAvailableRCRáRãRñRôRîRòRûRþRt!SocketPortRangeExhaustedExceptiontImageSerialPortNumberInvalidt&ImageSerialPortNumberExceedFlavorValueRR	RRRR$RRRCRJRFRUR]RaRëR!RjRgRkRyRR~R„R†RRR”R>R’R}R›RžR¤R©R­Rµtshelved_poll_intervalRºRÐR×RåRèRêR+RìR£RõRðRœRRtupdate_resources_intervalR¯Rt&running_deleted_instance_poll_intervalRRRRRSRîRR#R$R,R-timage_cache_manager_intervalR6tinstance_delete_intervalR>RBtInstanceQuiesceNotSupportedtQemuGuestAgentNotEnabledRŠRDRJRL(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyR»äs&.						
"	1				ÿ		*	
		!					
	"		%			6					
	/						w		_		
aK++				k		|	\	7	&J/9:@K&7	+M		I
	.	&				;								"k		<.% 	
	!?	6	&l		
E:,	bV5Y	5	¢#		L		 		-	
(€RMRÑRÔR¹RTR@RiRÆRòR‚tcinderclientRR¼teventlet.eventR…Rteventlet.semaphoreteventlet.timeoutt
keystoneauth1R¾toslo_logRtloggingtoslo_messagingRNtoslo_serializationRtoslo_serviceRRt
oslo_utilsRRRRt	six.movesR	RR
t
nova.cellsRRÏtnova.cloudpipeRR
tnova.computeRRRRRÇRRRgtnova.compute.utilsRRRt	nova.confRtnova.contextRRRt	nova.i18nRRRRRt
nova.imageR R!R"tnova.networkR#R(R$Rtnova.network.security_groupR%R&tnova.objectsR'RnR(R)RJR*Rqtnova.pciR+R,R-tnova.schedulerR.RÑt	nova.virtR.R/R0R1R”R2R3tnova.volumeR4R5tconfRÕt	getLoggerR¥RGtpartialR7RQtexpects_func_argsRVRaRjRnR}R“R~tVirtAPIR¨tManagerR»(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/nova/compute/manager.pyt<module>s°	#+	(yG