Repository URL to install this package:
|
Version:
2.5 ▾
|
ó
±EYc @ s{ d d l m Z d d l Z d d l m Z d d l m Z d d l m Z e j j
Z
d e f d YZ d Z
d S( iÿÿÿÿ( t jsonutilsN( t exception( t _( t devspect Whitelistc B s5 e Z d Z d Z d d Z d Z d Z RS( s# White list class to decide assignable pci devices.
Not all devices on compute node can be assigned to guest, the
cloud administrator decides the devices that can be assigned
based on vendor_id or product_id etc. If no white list specified,
no device will be assignable.
c C s g } xõ | D]í } y t j | } Wn- t k
rU t j d t d | n Xt | t rq | g } n. t | t s t j d t d | n xX | D]P } t | t sÚ t j d t d | n t j
| } | j | q¦ Wq
W| S( s: Parse and validate the pci whitelist from the nova config.t reasons Invalid entry: '%s's+ Invalid entry: '%s'; Expecting list or dicts# Invalid entry: '%s'; Expecting dict( R t loadst
ValueErrorR t PciConfigInvalidWhitelistR t
isinstancet dictt listR t
PciDeviceSpect append( t selft
whitelistst specst jsonspect dev_spect dst spec( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyt _parse_white_list_from_config% s*
c C s; t t | j | r. | j | | _ n g | _ d S( s½ White list constructor
For example, followed json string specifies that devices whose
vendor_id is '8086' and product_id is '1520' can be assigned
to guest.
'[{"product_id":"1520", "vendor_id":"8086"}]'
:param whitelist_spec: A json string for a list of dictionaries,
each dictionary specifies the pci device
properties requirement.
N( t superR t __init__R R ( R t whitelist_spec( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyR @ s c C s+ x$ | j D] } | j | r
t Sq
Wt S( sy Check if a device can be assigned to a guest.
:param dev: A dictionary describing the device properties
( R t matcht Truet False( R t devR ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyt device_assignableR s c C s+ x$ | j D] } | j | r
| Sq
Wd S( N( R t
match_pci_obj( R t pci_devR ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyt get_devspec\ s N( t __name__t
__module__t __doc__R t NoneR R R ( ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyR s
c C s t t j } | j | S( N( R t CONFt pci_passthrough_whitelistR ( R t
dev_filter( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyt get_pci_device_devspecb s ( t oslo_serializationR t nova.conft novaR t nova.i18nR t nova.pciR t confR% t objectR R( ( ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/nova/pci/whitelist.pyt <module> s G