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@sdZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZ
ddlmZdd	lmZdd
lmZddlmZddlZddlZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z"ddl#m$Z%ddl#m&Z'da)e
j*e+ƒZ,e	j-dƒZ.e	j-dƒZ/e	j-ej0râdndƒZ1ej2j3Z3dZ4dZ5de6fd„ƒYZ7dS(sø
Manages information about the host OS and hypervisor.

This class encapsulates a connection to the libvirt
daemon and provides certain higher level APIs around
the raw libvirt API. These APIs are then used by all
the other libvirt related classes
iÿÿÿÿN(tgreenio(tgreenthread(tpatcher(ttpool(tlog(texcutils(timportutils(tunits(tversionutils(tcontext(t	exception(t_(t_LE(t_LI(t_LW(trpc(tutils(tevent(tconfig(tguesttsockett	threadingtQueuetqueuetQEMUtXentHostcBs$eZed2d2d„Zd„Zd„Zed„ƒZd„Z	ed„ƒZ
ed„ƒZed„ƒZd„Z
d	„Zd
„Zd„Zd„Zd
„Zd„Zd„Zd„Zed„ƒZd„Zd2d2d2ejd„Zd2d2d2d„Zd2d2d2d„Zd„Zd„Zd„Zd„Z e!d„Z"e!d„Z#e!e!d„Z$e!e!d„Z%d„Z&d„Z'd „Z(d!„Z)d"„Z*d#„Z+d2d$„Z,d%„Z-d&„Z.d'„Z/d(„Z0d)„Z1d*„Z2d+„Z3d,„Z4d-d.„Z5d-d/„Z6d0„Z7d1„Z8RS(3cCs”tdkrtjdƒan||_||_||_||_t|_	d|_
d|_d|_t
jƒ|_d|_i|_d|_dS(Ntlibvirti(RtNoneRt
import_modulet_urit
_read_onlyt_conn_event_handlert_lifecycle_event_handlertFalset_skip_list_all_domainst_capst	_hostnamet
_wrapped_connRtLockt_wrapped_conn_lockt_event_queuet_events_delayedt_lifecycle_delay(tselfturit	read_onlytconn_event_handlertlifecycle_event_handler((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt__init__Os										cCsxtrtjƒqWdS(sêReceives async events coming in from libvirtd.

        This is a native thread which runs the default
        libvirt event loop implementation. This processes
        any incoming async events from libvirtd and queues
        them for later dispatch. This thread is only
        permitted to use libvirt python APIs, and the
        driver.queue_event method. In particular any use
        of logging is forbidden, since it will confuse
        eventlet's greenthread integration
        N(tTrueRtvirEventRunDefaultImpl(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_native_threadjs
	cCsxtr|jƒqWdS(sæDispatches async events coming in from libvirtd.

        This is a green thread which waits for events to
        arrive from the libvirt event loop thread. This
        then dispatches the events to the compute manager.
        N(R2t_dispatch_events(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_dispatch_threadzs	cCs°|}|jƒ}d}|tjkr3tj}nQ|tjkrNtj}n6|tjkritj	}n|tj
kr„tj}n|dk	r¬|jtj
||ƒƒndS(sReceives lifecycle events from libvirt.

        NB: this method is executing in a native thread, not
        an eventlet coroutine. It can only invoke other libvirt
        APIs, or use self._queue_event(). Any use of logging APIs
        in particular is forbidden.
        N(t
UUIDStringRRtVIR_DOMAIN_EVENT_STOPPEDt	virteventtEVENT_LIFECYCLE_STOPPEDtVIR_DOMAIN_EVENT_STARTEDtEVENT_LIFECYCLE_STARTEDtVIR_DOMAIN_EVENT_SUSPENDEDtEVENT_LIFECYCLE_PAUSEDtVIR_DOMAIN_EVENT_RESUMEDtEVENT_LIFECYCLE_RESUMEDt_queue_eventtLifecycleEvent(tconntdomRtdetailtopaqueR,tuuidt
transition((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_event_lifecycle_callback…s
cCs%i|d6|d6}|j|ƒdS(NRCtreason(RA(R,RCRJRFt
close_info((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_close_callbackŸscCsy|jƒtSWnftjk
rz}|jƒtjtjfkrt|jƒtjtj	fkrtt
jdƒtS‚nXdS(NsConnection to libvirt broke(
t
getLibVersionR2RtlibvirtErrortget_error_codetVIR_ERR_SYSTEM_ERRORtVIR_ERR_INTERNAL_ERRORtget_error_domaintVIR_FROM_REMOTEtVIR_FROM_RPCtLOGtdebugR"(RCte((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_test_connection£s

cCs9t|ƒdkrdStjtdƒt|ƒƒ‚dS(Nis8Can not handle authentication request for %d credentials(tlenR
t
NovaExceptionR(tcredsRF((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_connect_auth_cb±s
	cCsvtjtjtjtjtjtjgtjdg}d}|rNtj
}ntjtj
tjftj|||ƒS(Ni(RtVIR_CRED_AUTHNAMEtVIR_CRED_ECHOPROMPTtVIR_CRED_REALMtVIR_CRED_PASSPHRASEtVIR_CRED_NOECHOPROMPTtVIR_CRED_EXTERNALRR\RtVIR_CONNECT_RORt
proxy_callt	virDomaint
virConnecttopenAuth(R-R.tauthtflags((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_connect¹s		cCsP|jdkrdS|jj|ƒdjƒ}|jj|ƒ|jjƒdS(säPuts an event on the queue for dispatch.

        This method is called by the native event thread to
        put events on the queue for later dispatch by the
        green thread. Any use of logging APIs is forbidden.
        Nt (R)Rtputtencodet_event_notify_sendtwritetflush(R,Rtc((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyRAÎscCsQy"|jjdƒ}|s!t‚Wntk
r6dSXd}x†|jjƒsÅy\|jjdtƒ}t	|t
jƒr‰|j|ƒn!d|krªd|krª|}nWq@t
jk
rÁq@Xq@W|dkrÖdS|d}|jb||jkrGt|dƒ}tdƒ|}d|_|jdk	rG|jt|ƒqGnWdQXdS(s¦Wait for & dispatch events from native thread

        Blocks until native thread indicates some events
        are ready. Then dispatches all queued events.
        iNtblockRCRJsConnection to libvirt lost: %s(t_event_notify_recvtreadtAssertionErrort
ValueErrorRR)temptytgetR"t
isinstanceR9RBt_event_emit_delayedtnative_QueuetEmptyR(R&tstrRR (R,t_ctlast_close_eventRRCRJtmsg((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyR5ás2	



	csȇfd†}|jˆjjƒkrgˆj|jjƒˆjj|jdƒtjd|jƒn|jt	j
kr·tjˆj
ˆj|ƒ}|ˆj|j<|j||ƒn
ˆj|ƒdS(sEmit events - possibly delayed.cs$|d}ˆjj|jdƒdS(s’Callback function for greenthread. Called
            to cleanup the _events_delayed dictionary when an event
            was called.
            iN(R*tpopRGR(tgttargstkwargsR(R,(sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
event_cleanup
s
s3Removed pending event for %s due to lifecycle eventN(RGR*tkeystcancelRRRURVRHR9R:Rtspawn_afterR+t_event_emittlink(R,RR…tid_((R,sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyRzs		
cCs#|jdk	r|j|ƒndS(N(R!R(R,R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyR‰(scCs%tjƒ|_yFtjƒ\}}tj|ddƒ|_tj|ddƒ|_WnÉt	t
fk
r tjtj
tjƒ}|jdƒ|jdƒtjtj
tjƒ}|jd|jƒdfƒ|jƒ\}}|jddƒ|_tj|ƒ}|jddƒ|_nXdS(	s°Create a self-pipe for the native thread to synchronize on.

        This code is taken from the eventlet tpool module, under terms
        of the Apache License v2.0.
        twbitrbt	localhosti2iN(s	localhosti(R{RR)tostpipeRt	GreenPipeRnRstImportErrortNotImplementedErrort
native_socketRtAF_INETtSOCK_STREAMtbindtlistentconnecttgetsocknametaccepttmakefiletGreenSocket(R,trpipetwpipetsocktcsocktnsocktaddrtgsock((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_init_events_pipe,s

cCsm|jƒtjdƒtjd|jƒ|_|jjtƒ|jj	ƒtjdƒt
j|jƒdS(sêInitializes the libvirt events subsystem.

        This requires running a native thread to provide the
        libvirt event loop integration. This forwards events
        to a green thread which does the actual dispatching.
        sStarting native event threadttargetsStarting green dispatch threadN(
R¥RURVtnative_threadingtThreadR4t
_event_threadt	setDaemonR2tstartRtspawnR6(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_init_eventsEs

	

cCs…tjd|jƒd}z|j|j|jƒ}Wdd}|sMd}n|jdk	ru|jt|ƒ|ƒnX||_y0tjd|ƒ|j	dt
j|j|ƒWn:t
k
rë}tjtdƒi|jd6|d6ƒnXy-tjdt|ƒƒ|j|jdƒWnettfk
rD}tjd|ƒn=t
jk
r€}tjtd	ƒi|jd6|d6ƒnX|S(
NsConnecting to libvirt: %ssFailed to connect to libvirts#Registering for lifecycle events %ss.URI %(uri)s does not support events: %(error)sR-terrors%Registering for connection events: %ssVThe version of python-libvirt does not support registerCloseCallback or is too old: %ss9URI %(uri)s does not support connection events: %(error)s(RURVRRRjRR tboolR&tdomainEventRegisterAnyRtVIR_DOMAIN_EVENT_ID_LIFECYCLERIt	ExceptiontwarningRR}tregisterCloseCallbackRLt	TypeErrortAttributeErrorRN(R,twrapped_conntdisable_reasonRW((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_get_new_connectionXs<			
cCsC|j4|j}|s*|j|ƒr9|jƒ}nWdQX|S(N(R(R&RXR¹(R,R·((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_get_connection‰s

	cCs˜y|jƒ}Wntjk
r“}tjtdƒ|ƒtdtjddd|ƒ}t	j
dƒjtj
ƒd|ƒtjdtjƒ‚nX|S(	sÏReturns a connection to the hypervisor

        This method should be used to create and return a well
        configured connection to the hypervisor.

        :returns: a libvirt.virConnect object
        s Connection to libvirt failed: %stiptmethodRjRJtcomputescompute.libvirt.errorthost(RºRRNRUR
RtdicttCONFtmy_ipRtget_notifierR®tnova_contexttget_admin_contexttHypervisorUnavailableR¾(R,RCtextpayload((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_connection’s	cCsdS(N((R	terr((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_libvirt_error_handler¨scCs4tj|jdƒtjƒ|jƒt|_dS(N(RtregisterErrorHandlerRÊRtvirEventRegisterDefaultImplR­R2t_initialized(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
initialize­s

c	CsÆ|jƒ}y¡|dk	rF|jƒ}||tj|ƒƒrFtSn|dk	r}|jƒ}||tj|ƒƒr}tSn|dk	r¨|jƒ}||kr¨tSntSWnt	k
rÁtSXdS(sCheck libvirt version, hypervisor version, and hypervisor type

        :param hv_type: hypervisor driver from the top of this file.
        N(
RÈRRMRtconvert_version_to_intR"t
getVersiontgetTypeR2R²(	R,tlv_verthv_verthv_typetopRCtlibvirt_versionthypervisor_versionthypervisor_type((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_version_check¶s&
c	Cs%|jd|d|d|dtjƒS(NRÒRÓRÔRÕ(RÙtoperatortlt(R,RÒRÓRÔ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pythas_min_versionÓs	c	Cs%|jd|d|d|dtjƒS(NRÒRÓRÔRÕ(RÙRÚtne(R,RÒRÓRÔ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pythas_version×s	cCs|j|jƒS(s»Retrieve libvirt domain object for an instance.

        :param instance: an nova.objects.Instance object

        Attempt to lookup the libvirt domain objects
        corresponding to the Nova instance, based on
        its name. If not found it will raise an
        exception.InstanceNotFound exception. On other
        errors, it will raise an exception.NovaException
        exception.

        :returns: a libvirt.Domain object
        (t_get_domain_by_nametname(R,tinstance((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
get_domainÜscCstj|j|ƒƒS(s¦Retrieve libvirt domain object for an instance.

        :param instance: an nova.objects.Instance object

        :returns: a nova.virt.libvirt.Guest object
        (t
libvirt_guesttGuestRâ(R,Rá((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt	get_guestìscCsžy|jƒ}|j|ƒSWnztjk
r™}|jƒ}|tjkrbtjd|ƒ‚ntdƒi|d6|d6|d6}tj	|ƒ‚nXdS(sÆRetrieve libvirt domain object given an instance id.

        All libvirt error handling should be handled in this method and
        relevant nova exceptions should be raised in response.

        tinstance_idsWError from libvirt while looking up %(instance_id)s: [Error Code %(error_code)s] %(ex)st
error_codeRÆN(
RÈt
lookupByIDRRNROtVIR_ERR_NO_DOMAINR
tInstanceNotFoundRRZ(R,RæRCRÆRçR€((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_get_domain_by_idös	
cCsžy|jƒ}|j|ƒSWnztjk
r™}|jƒ}|tjkrbtjd|ƒ‚ntdƒi|d6|d6|d6}tj	|ƒ‚nXdS(sÈRetrieve libvirt domain object given an instance name.

        All libvirt error handling should be handled in this method and
        relevant nova exceptions should be raised in response.

        RæsYError from libvirt while looking up %(instance_name)s: [Error Code %(error_code)s] %(ex)st
instance_nameRçRÆN(
RÈtlookupByNameRRNRORéR
RêRRZ(R,RìRCRÆRçR€((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyRßs	
cCs2tj}|s|tjB}n|jƒj|ƒS(N(RtVIR_CONNECT_LIST_DOMAINS_ACTIVEt!VIR_CONNECT_LIST_DOMAINS_INACTIVERÈtlistAllDomains(R,tonly_runningRi((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_list_instance_domains_fast"s	cCsg}g}|jƒjƒdkr‘xj|jƒjƒD]S}y3|j|ƒ}|j|ƒ|j|jƒƒWq7tjk
r‰q7q7Xq7Wn|r›|Sxi|jƒjƒD]U}y5|j	|ƒ}|jƒ|krè|j|ƒnWq®tjk
rq®q®Xq®W|S(Ni(
RÈtnumOfDomainst
listDomainsIDRëtappendR7R
RêtlistDefinedDomainsRß(R,RñtuuidstdomstidRDRà((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_list_instance_domains_slow)s(
cCs2g|jd|d|ƒD]}tj|ƒ^qS(s0Get a list of Guest objects for nova instances

        :param only_running: True to only return running instances
        :param only_guests: True to filter out any host domain (eg Dom-0)

        See method "list_instance_domains" for more information.

        :returns: list of Guest objects
        Rñtonly_guests(tlist_instance_domainsRãRä(R,RñRûRD((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytlist_guestsDs
cCsÅ|jsdy|j|ƒ}Wqdtjtfk
r`}tjtdƒi|d6ƒt|_qdXn|jr|j	|ƒ}ng}x9|D]1}|r°|j
ƒdkr°qŒn|j|ƒqŒW|S(s~Get a list of libvirt.Domain objects for nova instances

        :param only_running: True to only return running instances
        :param only_guests: True to filter out any host domain (eg Dom-0)

        Query libvirt to a get a list of all libvirt.Domain objects
        that correspond to nova instances. If the only_running parameter
        is true this list will only include active domains, otherwise
        inactive domains will be included too. If the only_guests parameter
        is true the list will have any "host" domain (aka Xen Domain-0)
        filtered out.

        :returns: list of libvirt.Domain objects
        sKUnable to use bulk domain list APIs, falling back to slow code path: %(ex)sRÆi(R#RòRRNR¶RUtinfoR
R2RútIDRõ(R,RñRûtalldomsRÆRøRD((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyRüQs		
cCsY|jƒjƒ\}}}tƒ}x.t|ƒD] }||r1|j|ƒq1q1W|S(sGet the set of CPUs that are online on the host

        Method is only used by NUMA code paths which check on
        libvirt version >= 1.0.4. getCPUMap() was introduced in
        libvirt 1.0.0.

        :returns: set of online CPUs, raises libvirtError on error

        (RÈt	getCPUMaptsettrangetadd(R,tcpustcpu_maptonlinetonline_cpustcpu((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_online_cpusws	
cCsM|jsF|jƒjƒ}tjtdƒ|ƒtjƒ|_|jj|ƒt	t
dƒrF|jjjj
dk	rFyh|jƒj|jjjjƒgt
jƒ}|rÞtjƒ}|j|ƒ|j|jjj_nWqCt
jk
r?}|jƒ}|t
jkr9tjtdƒi|jd6|d6ƒq@‚qCXqFn|jS(sReturns the host capabilities information

        Returns an instance of config.LibvirtConfigCaps representing
        the capabilities of the host.

        Note: The result is cached in the member attribute _caps.

        :returns: a config.LibvirtConfigCaps object
        sLibvirt host capabilities %st(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURESsEURI %(uri)s does not support full set of host capabilities: %(error)sR-R®N(R$RÈtgetCapabilitiesRURþR
tvconfigtLibvirtConfigCapst	parse_strthasattrRR¾R	tmodelRtbaselineCPUtto_xmlRtLibvirtConfigCPUtfeaturesRNROtVIR_ERR_NO_SUPPORTR³RR(R,txmlstrRR	RÆRç((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_capabilities‹s,
	

cCs|jƒjƒS(sLGet hypervisor type.

        :returns: hypervisor type (ex. qemu)

        (RÈRÑ(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_driver_type°scCs|jƒjƒS(sSGet hypervisor version.

        :returns: hypervisor version (ex. 12003)

        (RÈRÐ(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_version¹scCsm|jƒjƒ}|jdkr-||_n9||jkrftjtdƒi|jd6|d6ƒn|jS(s'Returns the hostname of the hypervisor.sSHostname has changed from %(old)s to %(new)s. A restart is required to take effect.toldtnewN(RÈtgetHostnameR%RRUR®R(R,thostname((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_hostnameÂs
cCs½|dkrtj}nO|dkr0tj}n7|dkrHtj}ntdƒ}tj||ƒ‚y |jƒ}|j||ƒSWn/tj	k
r¸}|j
ƒtjkr¹dSnXdS(sƒFind a secret.

        usage_type: one of 'iscsi', 'ceph', 'rbd' or 'volume'
        usage_id: name of resource in secret
        tiscsitrbdtcephtvolumesInvalid usage_type: %sN(srbdsceph(
RtVIR_SECRET_USAGE_TYPE_ISCSItVIR_SECRET_USAGE_TYPE_CEPHtVIR_SECRET_USAGE_TYPE_VOLUMERR
RZRÈtsecretLookupByUsageRNROtVIR_ERR_NO_SECRETR(R,t
usage_typetusage_idtusage_type_constR€RCRW((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytfind_secretÎsc	Cs.tjƒ}t|_t|_||_|d	kr?d|_nO|dkrWd|_n7|dkrod|_ntdƒ}tj	||ƒ‚|j
ƒ}yPtjd|ƒ|j
ƒ}|j|ƒ}|dk	rå|j|ƒn|SWn=tjk
r)tjƒtjtdƒ|ƒWdQXnXdS(
sCreate a secret.

        :param usage_type: one of 'iscsi', 'ceph', 'rbd' or 'volume'
                           'rbd' will be converted to 'ceph'.
        :param usage_id: name of resource in secret
        :param password: optional secret value to set
        R!R"R R#sInvalid usage_type: %ssSecret XML: %ss$Error defining a secret with XML: %sN(srbdsceph(R
tLibvirtConfigSecretR"t	ephemeraltprivateR*R)RR
RZRRURVRÈtsecretDefineXMLRtsetValueRRNRtsave_and_reraise_exceptionR®R(	R,R)R*tpasswordtsecret_confR€txmlRCtsecret((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
create_secretås.			
cCs/|j||ƒ}|dk	r+|jƒndS(s…Delete a secret.

        usage_type: one of 'iscsi', 'ceph', 'rbd' or 'volume'
        usage_id: name of resource in secret
        N(R,Rtundefine(R,R)R*R6((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
delete_secretscCs|jƒjƒS(s{Returns hardware information about the Node.

        Note that the memory size is reported in MiB instead of KiB.
        (RÈtgetInfo(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt_get_hardware_infoscCs|jƒdS(s-Returns the total numbers of cpu in the host.i(R;(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
get_cpu_countscCs|jƒdS(soGet the total memory size(MB) of physical computer.

        :returns: the total amount of memory(MB).
        i(R;(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_memory_mb_totalsc	CsºtjjƒdkrdStdƒ}|jƒjƒ}WdQX|jdƒ}|jdƒ}|jdƒ}tjj	d	krid}xÖ|j
d
tƒD]Â}yt|j
|ƒdƒ}Wn@tjk
rý}	tjtdƒi|jd
6|	d6ƒq˜nX|jdkr||7}q˜||t||dƒt||dƒt||dƒ7}q˜W|tjSt||dƒt||dƒt||dƒ}
|jƒ|
tjSdS(smGet the used memory size(MB) of physical computer.

        :returns: the total usage of memory(MB).
        tLINUX2tLINUX3is
/proc/meminfoNsMemFree:sBuffers:sCached:txenRûisCcouldn't obtain the memory from domain: %(uuid)s, exception: %(ex)sRGRÆi(R>R?(tsystplatformtuppertopenRttsplittindexRÀRt	virt_typeRýR"tintt_get_domain_infoRNRUR³RRGRùRtKiR=(R,tfptmtidx1tidx2tidx3tusedRtdom_memRWtavail((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytget_memory_mb_used#s0
#8cCs3|jƒjtjdƒ}|jƒd|d<|S(s9Returns the current CPU state of the host with frequency.iit	frequency(RÈtgetCPUStatsRtVIR_NODE_CPU_STATS_ALL_CPUSR;(R,tstats((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt
get_cpu_statsLscCs|jƒj|ƒS(s’Defines a domain, but does not start it.

        :param xml: XML domain definition of the guest.

        :returns: a virDomain instance
        (RÈt	defineXML(R,R5((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytwrite_instance_configUscCs|jƒj|ƒS(sWLookup a node device by its name.


        :returns: a virNodeDevice instance
        (RÈtnodeDeviceLookupByName(R,Rà((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytdevice_lookup_by_name^sicCs|jƒjd|ƒS(sPLookup pci devices.

        :returns: a list of virNodeDevice instance
        tpci(RÈtlistDevices(R,Ri((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytlist_pci_devicesfscCs|jƒj||ƒS(s5Compares the given CPU description with the host CPU.(RÈt
compareCPU(R,txmlDescRi((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytcompare_cpumscCsyy`tddƒK}x=|jƒD]/}|jƒdjdƒ}d|kr"tSq"WtSWdQXWntk
rttSXdS(s¯Returns whether kernel configuration CGROUP_SCHED is enabled

        CONFIG_CGROUP_SCHED may be disabled in some kernel configs to
        improve scheduler latency.
        s/proc/self/mountstrit,R	N(RDt	readlinesRER2R"tIOError(R,tfdtlinetbits((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytis_cpu_control_policy_capableqs
cCsttddƒdk	S(sZDetermines whether libvirt is supporting dump XML suitable for
        migration.
        tVIR_DOMAIN_XML_MIGRATABLEN(tgetattrRR(R,((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pytis_migratable_xml_flag‚s	N(9t__name__t
__module__R"RR1R4R6tstaticmethodRIRLRXR\RjRAR5RzR‰R¥R­R¹RºRÈRÊRÎRÚRÛRÙRÜRÞRâRåRëRßR2RòRúRýRüR
RRRRR,R7R9R;R<R=RSRXRZR\R_RbRjRm(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyRMsh					*					1								
		
&		%						"	
				)						(8t__doc__RÚRRRARteventletRRRRtoslo_logRtloggingt
oslo_utilsRRRRtsixt	nova.conftnovaR	RÃR
t	nova.i18nRRR
RRRt	nova.virtRR9tnova.virt.libvirtRR
RRãRRt	getLoggerRnRUtoriginalR”R§tPY2R{tconfRÀtHV_DRIVER_QEMUt
HV_DRIVER_XENtobjectR(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/host.pyt<module>sH