From 194b23c422b4120db8a9c2e16d2371fc31092a6b Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 22 Jan 2013 11:32:28 +0000 Subject: Merge LibvirtOpenVswitchDriver class into LibvirtGenericVIFDriver The LibvirtGenericVIFDriver class can use the 'vif_type' mapping field to determine whether an OVS network configuration is required, thus a dedicated driver for OVS is no longer required. The LibvirtOpenVswitchDriver class functionality is merged into LibvirtGenericVIFDriver. For backwards compatibility with the Folsom release, the existing LibvirtOpenVswitchDriver class is made to inherit from LibvirtGenericVIFDriver and directly call the bridge specific setup APIs. This eases migration to the new VIF impl during the Grizzly deployment lifecycle, with an expectation that the LibvirtOpenVswitchDriver stub will be deleted after the Havana release. Blueprint: libvirt-vif-driver Change-Id: Iac79e0880b6fbcca0fd8cc26b59d23e579b947fa Signed-off-by: Daniel P. Berrange --- nova/tests/test_libvirt_vif.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/test_libvirt_vif.py b/nova/tests/test_libvirt_vif.py index 58504dcd8..6a3530588 100644 --- a/nova/tests/test_libvirt_vif.py +++ b/nova/tests/test_libvirt_vif.py @@ -98,9 +98,18 @@ class LibvirtVifTestCase(test.TestCase): 'dhcp_server': '191.168.1.1', 'vif_uuid': 'vif-xxx-yyy-zzz', 'vif_devname': 'tap-xxx-yyy-zzz', + 'vif_type': network_model.VIF_TYPE_OVS, 'ovs_interfaceid': 'aaa-bbb-ccc', } + mapping_ovs_legacy = { + 'mac': 'ca:fe:de:ad:be:ef', + 'gateway_v6': net_ovs['gateway_v6'], + 'ips': [{'ip': '101.168.1.9'}], + 'dhcp_server': '191.168.1.1', + 'vif_uuid': 'vif-xxx-yyy-zzz', + } + mapping_none = { 'mac': 'ca:fe:de:ad:be:ef', 'gateway_v6': net_bridge['gateway_v6'], @@ -300,11 +309,8 @@ class LibvirtVifTestCase(test.TestCase): self.mapping_bridge_quantum, br_want) - def test_ovs_ethernet_driver(self): - d = vif.LibvirtOpenVswitchDriver() - xml = self._get_instance_xml(d, - self.net_ovs, - self.mapping_ovs) + def _check_ovs_ethernet_driver(self, d, net, mapping): + xml = self._get_instance_xml(d, net, mapping) doc = etree.fromstring(xml) ret = doc.findall('./devices/interface') @@ -318,6 +324,18 @@ class LibvirtVifTestCase(test.TestCase): script = node.find("script").get("path") self.assertEquals(script, "") + def test_ovs_ethernet_driver(self): + d = vif.LibvirtOpenVswitchDriver() + self._check_ovs_ethernet_driver(d, + self.net_ovs, + self.mapping_ovs_legacy) + + def test_ovs_ethernet_driver(self): + d = vif.LibvirtGenericVIFDriver() + self._check_ovs_ethernet_driver(d, + self.net_ovs, + self.mapping_ovs) + def test_ovs_virtualport_driver(self): d = vif.LibvirtOpenVswitchVirtualPortDriver() xml = self._get_instance_xml(d, -- cgit