Repository URL to install this package:
Version:
3.4.36 ▾
|
ó ±EYc @ s d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z e j e Z d Z e j j d e j e j f d Y Z e j j d e j e j f d Y Z d S( iÿÿÿÿN( t log( t jsonutils( t versionutils( t context( t db( t exception( t objects( t base( t fieldsc C s¨ t | t s t St j j j } x| | j D]q } | | k rG q/ n | j | } | j | } | | k ru t S| r/ t | | t | | k r t Sq/ q/ Wt S( N( t isinstancet PciDevicet FalseR t NovaPersistentObjectR t keyst obj_fieldst obj_attr_is_sett getattrt True( t obj_at obj_bt pci_ignore_fieldst namet is_set_at is_set_b( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt compare_pci_device_attributes s R c B sÉ e Z d Z d Z i e j d 6e j d e d 6e j d 6e j d 6e j d 6e j d 6e j d 6e j d e d 6e j d e d 6e j d e d 6e j d e d 6e j d 6e j d e d 6e j d e d 6Z e d Z d Z d Z d Z d Z d Z e d Z e j d Z e j d Z e d Z e j d Z e d Z d Z d Z d Z d" d Z d! Z! RS(# s3 Object 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. s 1.5t idt nullablet compute_node_idt addresst vendor_idt product_idt dev_typet statust dev_idt labelt instance_uuidt request_idt extra_infot numa_nodet parent_addrc C s, d } d } t d | D } | | k S( Nt conductort osapi_computei c s s. | ]$ } t j j t j d | Vq d S( s nova-N( R t Servicet get_minimum_versionR t get_admin_context( t .0t service( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pys <genexpr>| s ( s conductors osapi_compute( t min( t servicest min_parent_addr_versiont min_deployed( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt should_migrate_datau s c C sø t j | } | d k r1 d | k r1 | d =n | d k r d | k r | d d k r| | j d i } | d | d <n | d =n | d k rô d | k rô t j j t j j f } | d } | | k rô t j d d d d | | f qô n d S( Ni i R$ i R' R% t phys_functioni R t actiont obj_make_compatiblet reasons% status=%s not supported in version %s( i i ( i i ( i i ( R t convert_version_to_tuplet Nonet getR t PciDeviceStatust UNCLAIMABLEt UNAVAILABLER t ObjectActionError( t selft primitivet target_versionR% t added_statusesR ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyR6 s" c C s£ d } x | D] } | j | d q W| j d xh | j D]Z \ } } | | j j k ru t | | | qA | j } | j i | | 6 | | _ qA Wd S( 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# R R% R' N( s statuss instance_uuids ids extra_info( t popR9 t setdefaultt itemsR R t setattrR% t update( R? t dev_dictt no_changest keyt kt vR% ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt update_device s c O sB t t | j | | | j i | _ d | _ g | _ d S( N( t superR t __init__t obj_reset_changesR% R9 t parent_devicet child_devices( R? t argst kwargs( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyRO ° s c C s t | | S( N( R ( R? t other( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt __eq__º s c C s | | k S( N( ( R? RU ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt __ne__½ s c C s xU | j D]J } | d k r3 t | | | | q | j d } t j | | _ q W| | _ | j d | j k r | j d | _ n | S( NR% R4 ( R RF R: R t loadsR% t _contextRP R' ( R t pci_devicet db_devRJ R% ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt _from_db_objectÀ s c C s+ t j | | | } | j | | | S( N( R t pci_device_get_by_addrR\ ( t clsR R t dev_addrR[ ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt get_by_dev_addrÑ s c C s( t j | | } | j | | | S( N( R t pci_device_get_by_idR\ ( R^ R R R[ ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt get_by_dev_id× s c C s2 | } | j | t j j | _ | | _ | 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. ( RM R R; t AVAILABLER RY ( R^ R RH RZ ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt createÜ s c C s | j t j j k rC t j j | _ t j | j | j | j n?| j t j j k r| j } | j sØ d | k r| d r| j d i } | rº | j d rº | j } n | d | d <| | d <qnA | j j d d } | rd | k r| | d <n | j | d <d | k r?t j | d | d <n | rt j | j | j | j | } | j | j | | qn d S( NR' R% R4 ( R R R; t REMOVEDt DELETEDR t pci_device_destroyRY R R t obj_get_changesR3 R: R R% RC R9 R t dumpst pci_device_updateR\ ( R? t updatest extra_updatet pf_extrat db_pci( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt saveé s0 c C s x | D] } | | _ q Wd S( N( R ( t dev_listR t dev( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/nova/objects/pci_device.pyt _bulk_update_status s c C sÅ | j t j j k rN t j d | j d | j d | j d t j j g n | j t j j k rË | j } t g | D] } | j ^ qv s² t j d | j d | j n | j | t j j nÞ | j t j j k r©t j j t j j t j j f } | j } | r| j | k rXt j d | j d | j d | j d | j d | n | j t j j k r¦t j j | _ q¦q©t j d i | j d 6| j d 6 n t j j | _ | | _ d S( NR R R t hopestatust vf_addresssP Physical function addr: %(pf_addr)s parent of VF addr: %(vf_addr)s was not foundt pf_addrt vf_addr( R R R; Rc R t PciDeviceInvalidStatusR R R t PciDeviceTypet SRIOV_PFRR t allt is_availablet PciDeviceVFInvalidStatusRr R<