summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorGary Kotton <gkotton@redhat.com>2012-10-21 07:22:07 +0000
committerGary Kotton <gkotton@redhat.com>2012-11-09 00:03:27 +0000
commit8d59c4795f2ee19248e838c29a0bf7f8ecbbe877 (patch)
tree4cc4986781672a9970fdee2741584149c96c0c02 /nova/virt
parent3c9e48d1119b77428346680c2a009c44ff9bf2ce (diff)
Enable Quantum linux bridge VIF driver to use "bridge" type
Fixes bug 1078210 This fix should be used in conjunction with the patch https://review.openstack.org/#/c/14961/ Change-Id: Ifd79864db147fe3141e03bf1c931fd153d413305
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/libvirt/config.py4
-rw-r--r--nova/virt/libvirt/vif.py29
2 files changed, 15 insertions, 18 deletions
diff --git a/nova/virt/libvirt/config.py b/nova/virt/libvirt/config.py
index 4c3483cb9..58d065d21 100644
--- a/nova/virt/libvirt/config.py
+++ b/nova/virt/libvirt/config.py
@@ -460,13 +460,15 @@ class LibvirtConfigGuestInterface(LibvirtConfigGuestDevice):
if self.net_type == "ethernet":
if self.script is not None:
dev.append(etree.Element("script", path=self.script))
- dev.append(etree.Element("target", dev=self.target_dev))
elif self.net_type == "direct":
dev.append(etree.Element("source", dev=self.source_dev,
mode="private"))
else:
dev.append(etree.Element("source", bridge=self.source_dev))
+ if self.target_dev is not None:
+ dev.append(etree.Element("target", dev=self.target_dev))
+
if self.vporttype is not None:
vport = etree.Element("virtualport", type=self.vporttype)
for p in self.vportparams:
diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py
index 91088c3d2..f0228de92 100644
--- a/nova/virt/libvirt/vif.py
+++ b/nova/virt/libvirt/vif.py
@@ -276,6 +276,9 @@ class LibvirtOpenVswitchVirtualPortDriver(vif.VIFDriver):
class QuantumLinuxBridgeVIFDriver(vif.VIFDriver):
"""VIF driver for Linux Bridge when running Quantum."""
+ def get_bridge_name(self, network_id):
+ return ("brq" + network_id)[:LINUX_DEV_LEN]
+
def get_dev_name(self, iface_id):
return ("tap" + iface_id)[:LINUX_DEV_LEN]
@@ -284,28 +287,20 @@ class QuantumLinuxBridgeVIFDriver(vif.VIFDriver):
iface_id = mapping['vif_uuid']
dev = self.get_dev_name(iface_id)
- if CONF.libvirt_type != 'xen':
- linux_net.QuantumLinuxBridgeInterfaceDriver.create_tap_dev(dev)
+ bridge = self.get_bridge_name(network['id'])
+ linux_net.LinuxBridgeInterfaceDriver.ensure_bridge(bridge, None,
+ filtering=False)
conf = vconfig.LibvirtConfigGuestInterface()
-
- if CONF.libvirt_use_virtio_for_bridges:
- conf.model = 'virtio'
- conf.net_type = "ethernet"
conf.target_dev = dev
- if CONF.libvirt_type != 'xen':
- conf.script = ""
+ conf.net_type = "bridge"
conf.mac_addr = mapping['mac']
+ conf.source_dev = bridge
+ if CONF.libvirt_use_virtio_for_bridges:
+ conf.model = "virtio"
return conf
def unplug(self, instance, vif):
- """Unplug the VIF by deleting the port from the bridge."""
- network, mapping = vif
- dev = self.get_dev_name(mapping['vif_uuid'])
- try:
- if CONF.libvirt_type != 'xen':
- utils.execute('ip', 'link', 'delete', dev, run_as_root=True)
- except exception.ProcessExecutionError:
- LOG.warning(_("Failed while unplugging vif"), instance=instance)
- raise
+ """No action needed. Libvirt takes care of cleanup"""
+ pass