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    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / nova / objects / pci_device.pyc
Size: Mime:
ó
±EYc@sddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd	l
mZdd
l
mZejeƒZd„Zejjdejejfd
„ƒYƒZejjdejejfd„ƒYƒZdS(iÿÿÿÿN(tlog(t	jsonutils(tversionutils(tcontext(tdb(t	exception(tobjects(tbase(tfieldscCs¨t|tƒstStjjjƒ}x||jD]q}||krGq/n|j|ƒ}|j|ƒ}||krutS|r/t	||ƒt	||ƒkr tSq/q/Wt
S(N(t
isinstancet	PciDevicetFalseRtNovaPersistentObjectRtkeyst
obj_fieldstobj_attr_is_settgetattrtTrue(tobj_atobj_btpci_ignore_fieldstnametis_set_atis_set_b((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytcompare_pci_device_attributes sR
cBsÉeZdZdZiejƒd6ejdeƒd6ejƒd6ejƒd6ejƒd6ejƒd6ej	ƒd	6ejdeƒd
6ejdeƒd6ejdeƒd6ejdeƒd
6ej
ƒd6ejdeƒd6ejdeƒd6Zed„ƒZd„Z
d„Zd„Zd„Zd„Zed„ƒZejd„ƒZejd„ƒZed„ƒZejd„ƒZed„ƒZd„Zd„Zd„Zd"d „Z d!„Z!RS(#s3Object to represent a PCI device on a compute node.

    PCI devices are managed by the compute resource tracker, which discovers
    the devices from the hardware platform, claims, allocates and frees
    devices for instances.

    The PCI device information is permanently maintained in a database.
    This makes it convenient to get PCI device information, like physical
    function for a VF device, adjacent switch IP address for a NIC,
    hypervisor identification for a PCI device, etc. It also provides a
    convenient way to check device allocation information for administrator
    purposes.

    A device can be in available/claimed/allocated/deleted/removed state.

    A device is available when it is discovered..

    A device is claimed prior to being allocated to an instance. Normally the
    transition from claimed to allocated is quick. However, during a resize
    operation the transition can take longer, because devices are claimed in
    prep_resize and allocated in finish_resize.

    A device becomes removed when hot removed from a node (i.e. not found in
    the next auto-discover) but not yet synced with the DB. A removed device
    should not be allocated to any instance, and once deleted from the DB,
    the device object is changed to deleted state and no longer synced with
    the DB.

    Filed notes::

        | 'dev_id':
        |   Hypervisor's identification for the device, the string format
        |   is hypervisor specific
        | 'extra_info':
        |   Device-specific properties like PF address, switch ip address etc.

    s1.5tidtnullabletcompute_node_idtaddresst	vendor_idt
product_idtdev_typetstatustdev_idtlabelt
instance_uuidt
request_idt
extra_infot	numa_nodetparent_addrcCs,d}d}td„|Dƒƒ}||kS(Nt	conductort
osapi_computeicss.|]$}tjjtjƒd|ƒVqdS(snova-N(RtServicetget_minimum_versionRtget_admin_context(t.0tservice((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pys	<genexpr>|s(s	conductors
osapi_compute(tmin(tservicestmin_parent_addr_versiontmin_deployed((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytshould_migrate_dataus
	
c
Csøtj|ƒ}|dkr1d|kr1|d=n|dkr†d|kr†|ddk	r||jdiƒ}|d|d<n|d=n|dkrôd|krôtjjtjjf}|d	}||krôtj	d
ddd
||fƒ‚qôndS(NiiR$iR'R%t
phys_functioniR tactiontobj_make_compatibletreasons%status=%s not supported in version %s(ii(ii(ii(
Rtconvert_version_to_tupletNonetgetRtPciDeviceStatustUNCLAIMABLEtUNAVAILABLERtObjectActionError(tselft	primitivettarget_versionR%tadded_statusesR ((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyR6s"

	
	cCs£d}x|D]}|j|dƒq
W|jdƒxh|jƒD]Z\}}||jjƒkrut|||ƒqA|j}|ji||6ƒ||_qAWdS(sÿSync the content from device dictionary to device object.

        The resource tracker updates the available devices periodically.
        To avoid meaningless syncs with the database, we update the device
        object only if a value changed.
        R R#RR%R'N(sstatuss
instance_uuidsids
extra_info(	tpopR9t
setdefaulttitemsRR
tsetattrR%tupdate(R?tdev_dictt
no_changestkeytktvR%((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt
update_device”s

	cOsBtt|ƒj||Ž|jƒi|_d|_g|_dS(N(tsuperR
t__init__tobj_reset_changesR%R9t
parent_devicet
child_devices(R?targstkwargs((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyRO°s

		cCs
t||ƒS(N(R(R?tother((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt__eq__ºscCs||kS(N((R?RU((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt__ne__½scCs‘xU|jD]J}|dkr3t||||ƒq
|jdƒ}tj|ƒ|_q
W||_|jƒd|jkr|jd|_n|S(NR%R4(	RRFR:RtloadsR%t_contextRPR'(Rt
pci_devicetdb_devRJR%((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt_from_db_objectÀs	
cCs+tj|||ƒ}|j||ƒ|ƒS(N(Rtpci_device_get_by_addrR\(tclsRRtdev_addrR[((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytget_by_dev_addrÑscCs(tj||ƒ}|j||ƒ|ƒS(N(Rtpci_device_get_by_idR\(R^RRR[((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt
get_by_dev_id×scCs2|ƒ}|j|ƒtjj|_||_|S(sÍCreate a PCI device based on hypervisor information.

        As the device object is just created and is not synced with db yet
        thus we should not reset changes here for fields from dict.
        (RMRR;t	AVAILABLER RY(R^RRHRZ((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytcreateÜs
	
	cCs†|jtjjkrCtjj|_tj|j|j|j	ƒn?|jtjjkr‚|j
ƒ}|jƒsØd|kr|dr|jdiƒ}|rº|j
dƒrº|j}n|d|d<||d<qnA|jjddƒ}|rd|kr||d<n|j|d<d|kr?tj|dƒ|d<n|r‚tj|j|j|j	|ƒ}|j|j||ƒq‚ndS(NR'R%R4(R RR;tREMOVEDtDELETEDRtpci_device_destroyRYRRtobj_get_changesR3R:RR%RCR9Rtdumpstpci_device_updateR\(R?tupdatestextra_updatetpf_extratdb_pci((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytsaveés0


cCsx|D]}||_qWdS(N(R (tdev_listR tdev((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt_bulk_update_statuss
cCsÅ|jtjjkrNtjd|jd|jd|jdtjjgƒ‚n|jtj	j
krË|j}tg|D]}|j
ƒ^qvƒs²tjd|jd|jƒ‚n|j|tjjƒnÞ|jtj	jkr©tjjtjjtjjf}|j}|r‚|j|krXtjd|jd|jd|jd|jd|ƒ‚n|jtjjkr¦tjj|_q¦q©tjdi|jd6|jd6ƒntjj|_||_dS(	NRRR t
hopestatust
vf_addresssPPhysical function addr: %(pf_addr)s parent of VF addr: %(vf_addr)s was not foundtpf_addrtvf_addr(R RR;RcRtPciDeviceInvalidStatusRRRt
PciDeviceTypetSRIOV_PFRRtalltis_availabletPciDeviceVFInvalidStatusRrR<tSRIOV_VFR=RQtPciDevicePFInvalidStatusR'tLOGtdebugtCLAIMEDR#(R?R#tvfs_listtvftparent_ok_statusestparent((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytclaims@			%										
cCs’tjjtjjf}tjjtjjtjjf}tjjtjjf}|j|krtjd|j	d|j
d|jd|ƒ‚n|jtjjkrì|j|dkrìtjd|j	d|j
d|jd|dƒ‚n|j
tjjkrl|j}tg|D]}|j|k^qƒsStjd|j	d|j
ƒ‚n|j|tjjƒn¥|j
tjjkr|j}|rê|j|krØtjd|j	d|jd|jd|j
d|ƒ‚ntjj|_qtjd	i|jd
6|j
d6ƒntjj|_|d|_t|tƒrrd|krUg|d<n|djtj|ƒƒn|jj jtj|ƒƒdS(
NRRR Rstuuidtownert	hopeownerRtsPPhysical function addr: %(pf_addr)s parent of VF addr: %(vf_addr)s was not foundRuRvtpci_devices(!RR;RcRR<R=R RRwRRR#tPciDeviceInvalidOwnerRRxRyRRRzR|RrR}RQR~R'RR€t	ALLOCATEDR	tdicttappendtcopyRŠR(R?tinstancetok_statusesR„tdependants_ok_statusesR‚RƒR…((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytallocateAs^									"								


c	Css|jtjjkrNtjd|jd|jd|jdtjjgƒ‚ntjj|_d|_
d|_dS(NRRR Rs(R RR;RcRRwRRReR9R#R$(R?((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytremove{s			c	sGtjjtjjf}g}ˆj|kr]tjdˆjdˆjdˆjd|ƒ‚n|rªˆj	|dkrªtj
dˆjdˆjdˆj	d|dƒ‚nˆjtjj
krîˆj}ˆj|tjjƒ|j|ƒnˆjtjjkr›ˆj}|s9tjdiˆjd	6ˆjd
6ƒq›|j}tg|D]$}|jˆjkrL|jƒ^qLƒr›tjj|_|j|ƒq›nˆj}tjjˆ_|jˆƒdˆ_	dˆ_|tjjkrC|rCt‡fd†|dDƒƒ}t|tƒr-|dj |ƒqC|j!j"j |ƒn|S(
NRRR RsR‡RˆR‰sPPhysical function addr: %(pf_addr)s parent of VF addr: %(vf_addr)s was not foundRuRvc3s'|]}|jˆjkr|VqdS(N(R(R-Rq(R?(sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pys	<genexpr>¯sRŠ(#RR;RŒRR RRwRRR#R‹RRxRyRRRrRctextendR}RQRR€R'RzRR{RŽR9R$tnextR	RR”RŠR(	R?RR‘t	free_devsR‚R…Rƒt
old_statustexisted((R?sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytfree…sP							
		
	'	
		 cCs|jtjjkS(N(R RR;Rc(R?((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyR{·sN("t__name__t
__module__t__doc__tVERSIONRtIntegerFieldRtStringFieldtPciDeviceTypeFieldtPciDeviceStatusFieldtDictOfStringsFieldtstaticmethodR3R6RMRORVRWR\Rtremotable_classmethodR`RbtclassmethodRdt	remotableRoRrR†R“R”R9RšR{(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyR
1sD'






			
		
"	1	:	
2t
PciDeviceListcBsceZdZiejdƒd6Zd„Zejd„ƒZejd„ƒZ	ejd„ƒZ
RS(s1.3R
RcOs?tt|ƒj||Žd|kr;g|_|jƒndS(NR(RNR¨RORRP(R?RSRT((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyROÈs	cCs1tj||ƒ}tj|||ƒtj|ƒS(N(Rtpci_device_get_all_by_nodeRt
obj_make_listRR
(R^Rtnode_idtdb_dev_list((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytget_by_compute_nodeÎscCs1tj||ƒ}tj|||ƒtj|ƒS(N(Rt#pci_device_get_all_by_instance_uuidRRªRR
(R^RR‡R¬((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytget_by_instance_uuidÔscCs4tj|||ƒ}tj|||ƒtj|ƒS(N(Rt!pci_device_get_all_by_parent_addrRRªRR
(R^RR«R'R¬((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pytget_by_parent_addressÚs
		(R›RœRžRtListOfObjectsFieldRORR¥R­R¯R±(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyR¨»s	(Rtoslo_logRtloggingtoslo_serializationRt
oslo_utilsRtnovaRRRRtnova.objectsRRt	getLoggerR›RRtNovaObjectRegistrytregisterRt
NovaObjectR
tObjectListBaseR¨(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt<module>s 	ÿŠ