Merge "Don't set bandwidth limits for vhostuser, hostdev interfaces"
This commit is contained in:
commit
4a92b338d9
|
@ -576,6 +576,8 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
|||
self.assertEqual(pci_slot, pci_slot_want)
|
||||
|
||||
def _assertXmlEqual(self, expectedXmlstr, actualXmlstr):
|
||||
if not isinstance(actualXmlstr, six.string_types):
|
||||
actualXmlstr = etree.tostring(actualXmlstr, pretty_print=True)
|
||||
self.assertThat(actualXmlstr, matchers.XMLMatches(expectedXmlstr))
|
||||
|
||||
def _get_conf(self):
|
||||
|
@ -610,6 +612,8 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
|||
nic = driver.get_config(self.instance, vif, image_meta,
|
||||
flavor, CONF.libvirt.virt_type,
|
||||
hostimpl)
|
||||
# TODO(stephenfin): There doesn't appear to be any reason we should do
|
||||
# this: just return 'nic.to_xml()' and remove '_get_node'
|
||||
conf.add_device(nic)
|
||||
return conf.to_xml()
|
||||
|
||||
|
@ -1630,6 +1634,25 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
|||
<target dev="nicdc065497-3c"/>
|
||||
</interface>""", cfg.to_xml())
|
||||
|
||||
@mock.patch("nova.network.os_vif_util.nova_to_osvif_instance")
|
||||
@mock.patch("nova.network.os_vif_util.nova_to_osvif_vif")
|
||||
def test_config_os_vif_vhostuser(self, mock_convert_vif,
|
||||
mock_convert_inst):
|
||||
mock_convert_vif.return_value = self.os_vif_vhostuser
|
||||
mock_convert_inst.return_value = self.os_vif_inst_info
|
||||
|
||||
d = vif.LibvirtGenericVIFDriver()
|
||||
xml = self._get_instance_xml(d, self.vif_vhostuser)
|
||||
node = self._get_node(xml)
|
||||
|
||||
self._assertXmlEqual("""
|
||||
<interface type="vhostuser">
|
||||
<mac address="22:52:25:62:e2:aa"/>
|
||||
<model type="virtio"/>
|
||||
<source mode="client"
|
||||
path="/var/run/openvswitch/vhudc065497-3c" type="unix"/>
|
||||
</interface>""", node)
|
||||
|
||||
@mock.patch("nova.network.os_vif_util.nova_to_osvif_instance")
|
||||
@mock.patch("nova.network.os_vif_util.nova_to_osvif_vif")
|
||||
def test_config_os_vif_agilio_ovs_fallthrough(self, mock_convert_vif,
|
||||
|
|
|
@ -573,7 +573,11 @@ class LibvirtGenericVIFDriver(object):
|
|||
{'obj': vif.obj_name(), 'func': viffunc})
|
||||
func(instance, vif, conf, host)
|
||||
|
||||
designer.set_vif_bandwidth_config(conf, inst_type)
|
||||
# not all VIF types support bandwidth configuration
|
||||
# https://github.com/libvirt/libvirt/blob/568a41722/src/conf/netdev_bandwidth_conf.h#L38
|
||||
if vif.obj_name() not in ('VIFVHostUser', 'VIFHostDevice'):
|
||||
designer.set_vif_bandwidth_config(conf, inst_type)
|
||||
|
||||
if ('network' in vif and 'mtu' in vif.network and
|
||||
self._has_min_version_for_mtu(host)):
|
||||
designer.set_vif_mtu_config(conf, vif.network.mtu)
|
||||
|
|
Loading…
Reference in New Issue