Merge "Remove deprecated libvirt VIF driver code"
This commit is contained in:
@@ -387,26 +387,12 @@ class LibvirtVifTestCase(test.TestCase):
|
||||
self._assertTypeAndMacEquals(node, "bridge", "source", "bridge",
|
||||
self.vif_bridge, br_want, 1)
|
||||
|
||||
def test_bridge_driver(self):
|
||||
d = vif.LibvirtBridgeDriver(self._get_conn())
|
||||
self._check_bridge_driver(d,
|
||||
self.vif_bridge,
|
||||
self.vif_bridge['network']['bridge'])
|
||||
|
||||
def test_generic_driver_bridge(self):
|
||||
d = vif.LibvirtGenericVIFDriver(self._get_conn())
|
||||
self._check_bridge_driver(d,
|
||||
self.vif_bridge,
|
||||
self.vif_bridge['network']['bridge'])
|
||||
|
||||
def test_neutron_bridge_driver(self):
|
||||
d = vif.NeutronLinuxBridgeVIFDriver(self._get_conn())
|
||||
br_want = 'brq' + self.vif_bridge_neutron['network']['id']
|
||||
br_want = br_want[:network_model.NIC_NAME_LEN]
|
||||
self._check_bridge_driver(d,
|
||||
self.vif_bridge_neutron,
|
||||
br_want)
|
||||
|
||||
def _check_ivs_ethernet_driver(self, d, vif, dev_prefix):
|
||||
self.flags(firewall_driver="nova.virt.firewall.NoopFirewallDriver")
|
||||
xml = self._get_instance_xml(d, vif)
|
||||
@@ -461,13 +447,6 @@ class LibvirtVifTestCase(test.TestCase):
|
||||
|
||||
self.assertTrue(iface_id_found)
|
||||
|
||||
def test_ovs_virtualport_driver(self):
|
||||
d = vif.LibvirtOpenVswitchVirtualPortDriver(self._get_conn(ver=9011))
|
||||
want_iface_id = 'vif-xxx-yyy-zzz'
|
||||
self._check_ovs_virtualport_driver(d,
|
||||
self.vif_ovs_legacy,
|
||||
want_iface_id)
|
||||
|
||||
def test_generic_ovs_virtualport_driver(self):
|
||||
d = vif.LibvirtGenericVIFDriver(self._get_conn(ver=9011))
|
||||
want_iface_id = self.vif_ovs['ovs_interfaceid']
|
||||
@@ -489,14 +468,6 @@ class LibvirtVifTestCase(test.TestCase):
|
||||
self._assertTypeAndMacEquals(node, "bridge", "source", "bridge",
|
||||
vif, br_want, 1)
|
||||
|
||||
def test_quantum_hybrid_driver(self):
|
||||
br_want = "qbr" + self.vif_ovs['id']
|
||||
br_want = br_want[:network_model.NIC_NAME_LEN]
|
||||
d = vif.LibvirtHybridOVSBridgeDriver(self._get_conn())
|
||||
self._check_neutron_hybrid_driver(d,
|
||||
self.vif_ovs_legacy,
|
||||
br_want)
|
||||
|
||||
def test_generic_hybrid_driver(self):
|
||||
d = vif.LibvirtGenericVIFDriver(self._get_conn())
|
||||
br_want = "qbr" + self.vif_ovs['id']
|
||||
|
||||
@@ -777,149 +777,3 @@ class LibvirtGenericVIFDriver(LibvirtBaseVIFDriver):
|
||||
else:
|
||||
raise exception.NovaException(
|
||||
_("Unexpected vif_type=%s") % vif_type)
|
||||
|
||||
|
||||
class LibvirtBridgeDriver(LibvirtGenericVIFDriver):
|
||||
"""Retained in Grizzly for compatibility with Neutron
|
||||
drivers which do not yet report 'vif_type' port binding.
|
||||
Will be deprecated in Havana, and removed in Ixxxx.
|
||||
"""
|
||||
|
||||
def get_config(self, instance, vif, image_meta, inst_type):
|
||||
LOG.deprecated(_("The LibvirtBridgeDriver VIF driver is now "
|
||||
"deprecated and will be removed in the next release. "
|
||||
"Please use the LibvirtGenericVIFDriver VIF driver, "
|
||||
"together with a network plugin that reports the "
|
||||
"'vif_type' attribute"))
|
||||
return self.get_config_bridge(instance, vif, image_meta,
|
||||
inst_type)
|
||||
|
||||
def plug(self, instance, vif):
|
||||
self.plug_bridge(instance, vif)
|
||||
|
||||
def unplug(self, instance, vif):
|
||||
self.unplug_bridge(instance, vif)
|
||||
|
||||
|
||||
class LibvirtOpenVswitchDriver(LibvirtGenericVIFDriver):
|
||||
"""Retained in Grizzly for compatibility with Neutron
|
||||
drivers which do not yet report 'vif_type' port binding.
|
||||
Will be deprecated in Havana, and removed in Ixxxx.
|
||||
"""
|
||||
|
||||
def get_bridge_name(self, vif):
|
||||
return vif['network']['bridge'] or CONF.libvirt_ovs_bridge
|
||||
|
||||
def get_ovs_interfaceid(self, vif):
|
||||
return vif.get('ovs_interfaceid') or vif['id']
|
||||
|
||||
def get_config(self, instance, vif, image_meta, inst_type):
|
||||
LOG.deprecated(_("The LibvirtOpenVswitchDriver VIF driver is now "
|
||||
"deprecated and will be removed in the next release. "
|
||||
"Please use the LibvirtGenericVIFDriver VIF driver, "
|
||||
"together with a network plugin that reports the "
|
||||
"'vif_type' attribute"))
|
||||
return self.get_config_ovs_ethernet(instance,
|
||||
vif,
|
||||
image_meta, inst_type)
|
||||
|
||||
def plug(self, instance, vif):
|
||||
self.plug_ovs_ethernet(instance, vif)
|
||||
|
||||
def unplug(self, instance, vif):
|
||||
self.unplug_ovs_ethernet(instance, vif)
|
||||
|
||||
|
||||
class LibvirtHybridOVSBridgeDriver(LibvirtGenericVIFDriver):
|
||||
"""Retained in Grizzly for compatibility with Neutron
|
||||
drivers which do not yet report 'vif_type' port binding.
|
||||
Will be deprecated in Havana, and removed in Ixxxx.
|
||||
"""
|
||||
|
||||
def get_bridge_name(self, vif):
|
||||
return vif['network']['bridge'] or CONF.libvirt_ovs_bridge
|
||||
|
||||
def get_ovs_interfaceid(self, vif):
|
||||
return vif.get('ovs_interfaceid') or vif['id']
|
||||
|
||||
def get_config(self, instance, vif, image_meta, inst_type):
|
||||
LOG.deprecated(_("The LibvirtHybridOVSBridgeDriver VIF driver is now "
|
||||
"deprecated and will be removed in the next release. "
|
||||
"Please use the LibvirtGenericVIFDriver VIF driver, "
|
||||
"together with a network plugin that reports the "
|
||||
"'vif_type' attribute"))
|
||||
return self.get_config_ovs_hybrid(instance,
|
||||
vif,
|
||||
image_meta,
|
||||
inst_type)
|
||||
|
||||
def plug(self, instance, vif):
|
||||
return self.plug_ovs_hybrid(instance, vif)
|
||||
|
||||
def unplug(self, instance, vif):
|
||||
return self.unplug_ovs_hybrid(instance, vif)
|
||||
|
||||
|
||||
class LibvirtOpenVswitchVirtualPortDriver(LibvirtGenericVIFDriver):
|
||||
"""Retained in Grizzly for compatibility with Neutron
|
||||
drivers which do not yet report 'vif_type' port binding.
|
||||
Will be deprecated in Havana, and removed in Ixxxx.
|
||||
"""
|
||||
|
||||
def get_bridge_name(self, vif):
|
||||
return vif['network']['bridge'] or CONF.libvirt_ovs_bridge
|
||||
|
||||
def get_ovs_interfaceid(self, vif):
|
||||
return vif.get('ovs_interfaceid') or vif['id']
|
||||
|
||||
def get_config(self, instance, vif, image_meta, inst_type):
|
||||
LOG.deprecated(_("The LibvirtOpenVswitchVirtualPortDriver VIF driver "
|
||||
"is now deprecated and will be removed in the next "
|
||||
"release. Please use the LibvirtGenericVIFDriver VIF "
|
||||
"driver, together with a network plugin that reports "
|
||||
"the 'vif_type' attribute"))
|
||||
return self.get_config_ovs_bridge(instance,
|
||||
vif,
|
||||
image_meta,
|
||||
inst_type)
|
||||
|
||||
def plug(self, instance, vif):
|
||||
return self.plug_ovs_bridge(instance, vif)
|
||||
|
||||
def unplug(self, instance, vif):
|
||||
return self.unplug_ovs_bridge(instance, vif)
|
||||
|
||||
|
||||
class NeutronLinuxBridgeVIFDriver(LibvirtGenericVIFDriver):
|
||||
"""Retained in Grizzly for compatibility with Neutron
|
||||
drivers which do not yet report 'vif_type' port binding.
|
||||
Will be deprecated in Havana, and removed in Ixxxx.
|
||||
"""
|
||||
|
||||
def get_bridge_name(self, vif):
|
||||
network = vif['network']
|
||||
def_bridge = ("brq" + network['id'])[:network_model.NIC_NAME_LEN]
|
||||
return vif['network'].get('bridge') or def_bridge
|
||||
|
||||
def get_config(self, instance, vif, image_meta, inst_type):
|
||||
LOG.deprecated(_("The NeutronLinuxBridgeVIFDriver VIF driver is now "
|
||||
"deprecated and will be removed in the next release. "
|
||||
"Please use the LibvirtGenericVIFDriver VIF driver, "
|
||||
"together with a network plugin that reports the "
|
||||
"'vif_type' attribute"))
|
||||
# In order for libvirt to make use of the bridge name then it has
|
||||
# to ensure that the bridge exists
|
||||
network = vif['network']
|
||||
if network and not network.get_meta('should_create_bridge', False):
|
||||
vif['network']['meta']['should_create_bridge'] = True
|
||||
return self.get_config_bridge(instance, vif, image_meta,
|
||||
inst_type)
|
||||
|
||||
def plug(self, instance, vif):
|
||||
self.plug_bridge(instance, vif)
|
||||
|
||||
def unplug(self, instance, vif):
|
||||
self.unplug_bridge(instance, vif)
|
||||
|
||||
# For compatibility with existing Nova deployments
|
||||
QuantumLinuxBridgeVIFDriver = NeutronLinuxBridgeVIFDriver
|
||||
|
||||
Reference in New Issue
Block a user