test_vif.py (nova-22.0.0) | : | test_vif.py (nova-22.0.1) | ||
---|---|---|---|---|
skipping to change at line 558 | skipping to change at line 558 | |||
self.assertEqual(type, addr_type) | self.assertEqual(type, addr_type) | |||
pci_slot = "%(domain)s:%(bus)s:%(slot)s.%(func)s" % { | pci_slot = "%(domain)s:%(bus)s:%(slot)s.%(func)s" % { | |||
'domain': address.get("domain")[2:], | 'domain': address.get("domain")[2:], | |||
'bus': address.get("bus")[2:], | 'bus': address.get("bus")[2:], | |||
'slot': address.get("slot")[2:], | 'slot': address.get("slot")[2:], | |||
'func': address.get("function")[2:]} | 'func': address.get("function")[2:]} | |||
pci_slot_want = vif['profile']['pci_slot'] | pci_slot_want = vif['profile']['pci_slot'] | |||
self.assertEqual(pci_slot, pci_slot_want) | self.assertEqual(pci_slot, pci_slot_want) | |||
def _assertQueueSizeEquals(self, node, rx_want, tx_want): | ||||
rx_queue_size = node.find("driver").get("rx_queue_size") | ||||
tx_queue_size = node.find("driver").get("tx_queue_size") | ||||
self.assertEqual(rx_queue_size, rx_want) | ||||
self.assertEqual(tx_queue_size, tx_want) | ||||
def _assertXmlEqual(self, expectedXmlstr, actualXmlstr): | def _assertXmlEqual(self, expectedXmlstr, actualXmlstr): | |||
if not isinstance(actualXmlstr, six.string_types): | if not isinstance(actualXmlstr, six.string_types): | |||
actualXmlstr = etree.tostring(actualXmlstr, encoding='unicode', | actualXmlstr = etree.tostring(actualXmlstr, encoding='unicode', | |||
pretty_print=True) | pretty_print=True) | |||
self.assertXmlEqual(expectedXmlstr, actualXmlstr) | self.assertXmlEqual(expectedXmlstr, actualXmlstr) | |||
def _get_conf(self): | def _get_conf(self): | |||
conf = vconfig.LibvirtConfigGuest() | conf = vconfig.LibvirtConfigGuest() | |||
conf.virt_type = "qemu" | conf.virt_type = "qemu" | |||
conf.name = "fake-name" | conf.name = "fake-name" | |||
skipping to change at line 1298 | skipping to change at line 1304 | |||
self._assertTypeEquals(node, network_model.VIF_TYPE_VHOSTUSER, | self._assertTypeEquals(node, network_model.VIF_TYPE_VHOSTUSER, | |||
"source", "type", "unix") | "source", "type", "unix") | |||
self._assertMacEquals(node, self.vif_vhostuser) | self._assertMacEquals(node, self.vif_vhostuser) | |||
self._assertModel(xml, network_model.VIF_MODEL_VIRTIO) | self._assertModel(xml, network_model.VIF_MODEL_VIRTIO) | |||
def test_vhostuser_driver_queue_sizes(self): | def test_vhostuser_driver_queue_sizes(self): | |||
self.flags(rx_queue_size=512, group='libvirt') | self.flags(rx_queue_size=512, group='libvirt') | |||
self.flags(tx_queue_size=1024, group='libvirt') | self.flags(tx_queue_size=1024, group='libvirt') | |||
d = vif.LibvirtGenericVIFDriver() | d = vif.LibvirtGenericVIFDriver() | |||
xml = self._get_instance_xml(d, self.vif_vhostuser) | xml = self._get_instance_xml(d, self.vif_vhostuser) | |||
self._assertXmlEqual(""" | node = self._get_node(xml) | |||
<domain type="qemu"> | self._assertQueueSizeEquals(node, "512", "1024") | |||
<uuid>fake-uuid</uuid> | ||||
<name>fake-name</name> | ||||
<memory>102400</memory> | ||||
<vcpu>4</vcpu> | ||||
<os> | ||||
<type>None</type> | ||||
</os> | ||||
<devices> | ||||
<interface type="vhostuser"> | ||||
<mac address="ca:fe:de:ad:be:ef"/> | ||||
<model type="virtio"/> | ||||
<driver rx_queue_size="512" tx_queue_size="1024"/> | ||||
<source mode="client" path="/tmp/vif-xxx-yyy-zzz" type="unix"/> | ||||
</interface> | ||||
</devices> | ||||
</domain>""", xml) | ||||
def test_vhostuser_driver_no_path(self): | def test_vhostuser_driver_no_path(self): | |||
d = vif.LibvirtGenericVIFDriver() | d = vif.LibvirtGenericVIFDriver() | |||
self.assertRaises(exception.VifDetailsMissingVhostuserSockPath, | self.assertRaises(exception.VifDetailsMissingVhostuserSockPath, | |||
self._get_instance_xml, | self._get_instance_xml, | |||
d, | d, | |||
self.vif_vhostuser_no_path) | self.vif_vhostuser_no_path) | |||
def test_vhostuser_driver_ovs(self): | def test_vhostuser_driver_ovs(self): | |||
skipping to change at line 1556 | skipping to change at line 1546 | |||
def test_config_os_vif_vhostuser(self): | def test_config_os_vif_vhostuser(self): | |||
os_vif_type = self.os_vif_vhostuser | os_vif_type = self.os_vif_vhostuser | |||
vif_type = self.vif_vhostuser | vif_type = self.vif_vhostuser | |||
expected_xml = """ | expected_xml = """ | |||
<interface type="vhostuser"> | <interface type="vhostuser"> | |||
<mac address="22:52:25:62:e2:aa"/> | <mac address="22:52:25:62:e2:aa"/> | |||
<model type="virtio"/> | <model type="virtio"/> | |||
<source mode="client" | <source mode="client" | |||
path="/var/run/openvswitch/vhudc065497-3c" type="unix"/> | path="/var/run/openvswitch/vhudc065497-3c" type="unix"/> | |||
<target dev="vhudc065497-3c"/> | ||||
</interface>""" | </interface>""" | |||
self._test_config_os_vif(os_vif_type, vif_type, expected_xml) | self._test_config_os_vif(os_vif_type, vif_type, expected_xml) | |||
def test_config_os_vif_agilio_ovs_fallthrough(self): | def test_config_os_vif_agilio_ovs_fallthrough(self): | |||
os_vif_type = self.os_vif_agilio_ovs | os_vif_type = self.os_vif_agilio_ovs | |||
vif_type = self.vif_agilio_ovs | vif_type = self.vif_agilio_ovs | |||
expected_xml = """ | expected_xml = """ | |||
<interface type="bridge"> | <interface type="bridge"> | |||
skipping to change at line 1593 | skipping to change at line 1584 | |||
def test_config_os_vif_agilio_ovs_forwarder(self): | def test_config_os_vif_agilio_ovs_forwarder(self): | |||
os_vif_type = self.os_vif_agilio_forwarder | os_vif_type = self.os_vif_agilio_forwarder | |||
vif_type = self.vif_agilio_ovs_forwarder | vif_type = self.vif_agilio_ovs_forwarder | |||
expected_xml = """ | expected_xml = """ | |||
<interface type="vhostuser"> | <interface type="vhostuser"> | |||
<mac address="22:52:25:62:e2:aa"/> | <mac address="22:52:25:62:e2:aa"/> | |||
<model type="virtio"/> | <model type="virtio"/> | |||
<source mode="client" | <source mode="client" | |||
path="/var/run/openvswitch/vhudc065497-3c" type="unix"/> | path="/var/run/openvswitch/vhudc065497-3c" type="unix"/> | |||
<target dev="nicdc065497-3c"/> | ||||
</interface>""" | </interface>""" | |||
self._test_config_os_vif(os_vif_type, vif_type, expected_xml) | self._test_config_os_vif(os_vif_type, vif_type, expected_xml) | |||
def test_config_os_vif_agilio_ovs_direct(self): | def test_config_os_vif_agilio_ovs_direct(self): | |||
os_vif_type = self.os_vif_agilio_direct | os_vif_type = self.os_vif_agilio_direct | |||
vif_type = self.vif_agilio_ovs_direct | vif_type = self.vif_agilio_ovs_direct | |||
expected_xml = """ | expected_xml = """ | |||
<interface type="hostdev" managed="yes"> | <interface type="hostdev" managed="yes"> | |||
End of changes. 4 change blocks. | ||||
18 lines changed or deleted | 10 lines changed or added |