def test_set_vif_host_backend_hw_veb_hostdev(self): conf = config.LibvirtConfigGuestInterface() designer.set_vif_host_backend_hw_veb(conf, "hostdev", "fake-devname", "fake-vlan", "fake-tap") self.assertEqual("hostdev", conf.net_type) self.assertEqual("fake-devname", conf.source_dev) self.assertIsNone(conf.model) self.assertEqual("fake-vlan", conf.vlan) self.assertEqual("fake-tap", conf.target_dev)
def test_set_vif_host_backend_hw_veb_direct(self, mock_pci): conf = config.LibvirtConfigGuestInterface() designer.set_vif_host_backend_hw_veb(conf, "direct", "fake-pci-dev", "fake-vlan", "fake-tap") self.assertEqual("direct", conf.net_type) self.assertEqual("fake-devname", conf.source_dev) self.assertEqual("passthrough", conf.source_mode) self.assertEqual("vhost", conf.driver_name) self.assertEqual("fake-tap", conf.target_dev) mock_pci.assert_called_with("fake-pci-dev")
def test_set_vif_host_backend_hw_veb_direct(self, mock_pci): conf = config.LibvirtConfigGuestInterface() designer.set_vif_host_backend_hw_veb(conf, 'direct', 'fake-pci-dev', 'fake-vlan', 'fake-tap') self.assertEqual('direct', conf.net_type) self.assertEqual('fake-devname', conf.source_dev) self.assertEqual('passthrough', conf.source_mode) self.assertEqual('vhost', conf.driver_name) self.assertEqual('fake-tap', conf.target_dev) mock_pci.assert_called_with('fake-pci-dev')
def _set_config_VIFHostDevice(self, instance, vif, conf, host=None): if vif.dev_type == osv_fields.VIFHostDeviceDevType.ETHERNET: # This sets the required fields for an <interface type='hostdev'> # section in a libvirt domain (by using a subset of hw_veb's # options). designer.set_vif_host_backend_hw_veb( conf, 'hostdev', vif.dev_address, None) else: # TODO(jangutter): dev_type == VIFHostDeviceDevType.GENERIC # is currently unsupported under os-vif. The corresponding conf # class would be: LibvirtConfigGuestHostdevPCI # but os-vif only returns a LibvirtConfigGuestInterface object raise exception.InternalError( _("Unsupported os-vif VIFHostDevice dev_type %(type)s") % {'type': vif.dev_type})
def get_config_hw_veb(self, instance, vif, image_meta, inst_type, virt_type): conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type) profile = vif["profile"] vif_details = vif["details"] net_type = 'direct' if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT: net_type = 'hostdev' designer.set_vif_host_backend_hw_veb( conf, net_type, profile['pci_slot'], vif_details[network_model.VIF_DETAILS_VLAN]) designer.set_vif_bandwidth_config(conf, inst_type) return conf
def get_config_hw_veb(self, instance, vif, image_meta, inst_type, virt_type, host): conf = self.get_base_config(instance, vif['address'], image_meta, inst_type, virt_type) profile = vif["profile"] vif_details = vif["details"] net_type = 'direct' if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT: net_type = 'hostdev' designer.set_vif_host_backend_hw_veb( conf, net_type, profile['pci_slot'], vif_details[network_model.VIF_DETAILS_VLAN]) designer.set_vif_bandwidth_config(conf, inst_type) return conf
def get_config_hw_veb(self, instance, vif, image_meta, inst_type, virt_type, host): conf = self.get_base_config(instance, vif['address'], image_meta, inst_type, virt_type, vif['vnic_type']) profile = vif["profile"] vif_details = vif["details"] net_type = 'direct' if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT: net_type = 'hostdev' designer.set_vif_host_backend_hw_veb( conf, net_type, profile['pci_slot'], vif_details[network_model.VIF_DETAILS_VLAN]) # NOTE(vladikr): Not setting vlan tags for macvtap on SR-IOV VFs # as vlan tag is not supported in Libvirt until version 1.3.5 if (vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP and not host.has_min_version(MIN_LIBVIRT_MACVTAP_PASSTHROUGH_VLAN)): conf.vlan = None designer.set_vif_bandwidth_config(conf, inst_type) return conf
def get_config_hw_veb(self, instance, vif, image_meta, inst_type, virt_type, host): conf = self.get_base_config(instance, vif['address'], image_meta, inst_type, virt_type, vif['vnic_type']) profile = vif["profile"] vif_details = vif["details"] net_type = 'direct' if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT: net_type = 'hostdev' designer.set_vif_host_backend_hw_veb( conf, net_type, profile['pci_slot'], vif_details[network_model.VIF_DETAILS_VLAN]) # NOTE(vladikr): Not setting vlan tags for macvtap on SR-IOV VFs # as vlan tag is not supported in Libvirt until version 1.3.5 if (vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP and not host.has_min_version(MIN_LIBVIRT_MACVTAP_PASSTHROUGH_VLAN)): conf.vlan = None designer.set_vif_bandwidth_config(conf, inst_type) return conf