summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/network/quantumv2/api.py5
-rw-r--r--nova/virt/libvirt/vif.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py
index d11ffe1b3..c12b0f72b 100644
--- a/nova/network/quantumv2/api.py
+++ b/nova/network/quantumv2/api.py
@@ -666,6 +666,8 @@ class API(base.Base):
bridge = None
ovs_interfaceid = None
+ # Network model metadata
+ should_create_bridge = None
vif_type = port.get('binding:vif_type')
# TODO(berrange) Quantum should pass the bridge name
# in another binding metadata field
@@ -674,6 +676,7 @@ class API(base.Base):
ovs_interfaceid = port['id']
elif vif_type == network_model.VIF_TYPE_BRIDGE:
bridge = "brq" + port['network_id']
+ should_create_bridge = True
if bridge is not None:
bridge = bridge[:network_model.NIC_NAME_LEN]
@@ -689,6 +692,8 @@ class API(base.Base):
tenant_id=net['tenant_id']
)
network['subnets'] = subnets
+ if should_create_bridge is not None:
+ network['should_create_bridge'] = should_create_bridge
nw_info.append(network_model.VIF(
id=port['id'],
address=port['mac_address'],
diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py
index 1110d356e..4f355f565 100644
--- a/nova/virt/libvirt/vif.py
+++ b/nova/virt/libvirt/vif.py
@@ -452,6 +452,10 @@ class QuantumLinuxBridgeVIFDriver(LibvirtGenericVIFDriver):
return network.get('bridge') or def_bridge
def get_config(self, instance, network, mapping):
+ # In order for libvirt to make use of the bridge name then it has
+ # to ensure that the bridge exists
+ if 'should_create_bridge' not in mapping:
+ mapping['should_create_bridge'] = True
return self.get_config_bridge(instance, network, mapping)
def plug(self, instance, vif):