<s> """<STR_LIT>""" <EOL> import six <EOL> from nova . pci import utils as pci_utils <EOL> def set_vif_guest_frontend_config ( conf , mac , model , driver , queues = None ) : <EOL> """<STR_LIT>""" <EOL> conf . mac_addr = mac <EOL> if model is not None : <EOL> conf . model = model <EOL> if driver is not None : <EOL> conf . driver_name = driver <EOL> if queues is not None : <EOL> conf . vhost_queues = queues <EOL> def set_vif_host_backend_bridge_config ( conf , brname , tapname = None ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . source_dev = brname <EOL> if tapname : <EOL> conf . target_dev = tapname <EOL> def set_vif_host_backend_ethernet_config ( conf , tapname ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . target_dev = tapname <EOL> conf . script = "<STR_LIT>" <EOL> def set_vif_host_backend_ovs_config ( conf , brname , interfaceid , tapname = None ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . source_dev = brname <EOL> conf . vporttype = "<STR_LIT>" <EOL> conf . add_vport_param ( "<STR_LIT>" , interfaceid ) <EOL> if tapname : <EOL> conf . target_dev = tapname <EOL> def set_vif_host_backend_802qbg_config ( conf , devname , managerid , <EOL> typeid , typeidversion , <EOL> instanceid , tapname = None ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . source_dev = devname <EOL> conf . source_mode = "<STR_LIT>" <EOL> conf . vporttype = "<STR_LIT>" <EOL> conf . add_vport_param ( "<STR_LIT>" , managerid ) <EOL> conf . add_vport_param ( "<STR_LIT>" , typeid ) <EOL> conf . add_vport_param ( "<STR_LIT>" , typeidversion ) <EOL> conf . add_vport_param ( "<STR_LIT>" , instanceid ) <EOL> if tapname : <EOL> conf . target_dev = tapname <EOL> def set_vif_host_backend_802qbh_config ( conf , net_type , devname , profileid , <EOL> tapname = None ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = net_type <EOL> if net_type == '<STR_LIT>' : <EOL> conf . source_mode = '<STR_LIT>' <EOL> conf . source_dev = pci_utils . get_ifname_by_pci_address ( devname ) <EOL> conf . driver_name = '<STR_LIT>' <EOL> else : <EOL> conf . source_dev = devname <EOL> conf . model = None <EOL> conf . vporttype = "<STR_LIT>" <EOL> conf . add_vport_param ( "<STR_LIT>" , profileid ) <EOL> if tapname : <EOL> conf . target_dev = tapname <EOL> def set_vif_host_backend_hw_veb ( conf , net_type , devname , vlan , <EOL> tapname = None ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = net_type <EOL> if net_type == '<STR_LIT>' : <EOL> conf . source_mode = '<STR_LIT>' <EOL> conf . source_dev = pci_utils . get_ifname_by_pci_address ( devname ) <EOL> conf . driver_name = '<STR_LIT>' <EOL> else : <EOL> conf . source_dev = devname <EOL> conf . model = None <EOL> conf . vlan = vlan <EOL> if tapname : <EOL> conf . target_dev = tapname <EOL> def set_vif_host_backend_hostdev_pci_config ( conf , pci_slot ) : <EOL> """<STR_LIT>""" <EOL> conf . domain , conf . bus , conf . slot , conf . function = ( <EOL> pci_utils . get_pci_address_fields ( pci_slot ) ) <EOL> def set_vif_host_backend_direct_config ( conf , devname , mode = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . source_mode = mode <EOL> conf . source_dev = devname <EOL> conf . model = "<STR_LIT>" <EOL> def set_vif_host_backend_vhostuser_config ( conf , mode , path ) : <EOL> """<STR_LIT>""" <EOL> conf . net_type = "<STR_LIT>" <EOL> conf . vhostuser_type = "<STR_LIT>" <EOL> conf . vhostuser_mode = mode <EOL> conf . vhostuser_path = path <EOL> def set_vif_bandwidth_config ( conf , inst_type ) : <EOL> """<STR_LIT>""" <EOL> bandwidth_items = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> for key , value in six . iteritems ( inst_type . get ( '<STR_LIT>' , { } ) ) : <EOL> scope = key . split ( '<STR_LIT::>' ) <EOL> if len ( scope ) > <NUM_LIT:1> and scope [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> if scope [ <NUM_LIT:1> ] in bandwidth_items : <EOL> setattr ( conf , scope [ <NUM_LIT:1> ] , value ) </s>
