Created
October 4, 2015 17:12
-
-
Save yosshy/f81b22a3bd47c150e838 to your computer and use it in GitHub Desktop.
Patch for nova-2015.1 to use vSphere with Neutron (ML2/LinuxBridge/VLAN)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/network/neutronv2/api.py b/network/neutronv2/api.py | |
index 2f84715..abe9b25 100644 | |
--- a/network/neutronv2/api.py | |
+++ b/network/neutronv2/api.py | |
@@ -791,6 +791,7 @@ class API(base_api.NetworkAPI): | |
networks = networks + [ | |
{'id': iface['network']['id'], | |
'name': iface['network']['label'], | |
+ 'vlan': iface['network'].get('vlan'), | |
'tenant_id': iface['network']['meta']['tenant_id']} | |
for iface in ifaces] | |
@@ -1115,10 +1116,18 @@ class API(base_api.NetworkAPI): | |
networks = client.list_networks().get('networks') | |
network_objs = [] | |
for network in networks: | |
+ vlan = None | |
+ should_create_vlan = False | |
+ if network.get('provider:network_type') == 'vlan': | |
+ vlan = network.get('provider:segmentation_id') | |
+ should_create_vlan = True | |
network_objs.append(objects.Network(context=context, | |
name=network['name'], | |
label=network['name'], | |
- uuid=network['id'])) | |
+ uuid=network['id'], | |
+ vlan=vlan, | |
+ should_create_vlan= | |
+ should_create_vlan)) | |
return objects.NetworkList(context=context, | |
objects=network_objs) | |
@@ -1129,10 +1138,17 @@ class API(base_api.NetworkAPI): | |
network = client.show_network(network_uuid).get('network') or {} | |
except neutron_client_exc.NetworkNotFoundClient: | |
raise exception.NetworkNotFound(network_id=network_uuid) | |
+ vlan = None | |
+ should_create_vlan = False | |
+ if network.get('provider:network_type') == 'vlan': | |
+ vlan = network.get('provider:segmentation_id') | |
+ should_create_vlan = True | |
net_obj = objects.Network(context=context, | |
name=network['name'], | |
label=network['name'], | |
- uuid=network['id']) | |
+ uuid=network['id'], | |
+ vlan=vlan, | |
+ should_create_vlan=should_create_vlan) | |
return net_obj | |
def delete(self, context, network_uuid): | |
@@ -1421,6 +1437,11 @@ class API(base_api.NetworkAPI): | |
if port['network_id'] == net['id']: | |
network_name = net['name'] | |
tenant_id = net['tenant_id'] | |
+ vlan = None | |
+ should_create_vlan = False | |
+ if net.get('provider:network_type') == 'vlan': | |
+ vlan = net.get('provider:segmentation_id') | |
+ should_create_vlan = True | |
break | |
else: | |
tenant_id = port['tenant_id'] | |
@@ -1463,7 +1484,9 @@ class API(base_api.NetworkAPI): | |
bridge=bridge, | |
injected=CONF.flat_injected, | |
label=network_name, | |
- tenant_id=tenant_id | |
+ tenant_id=tenant_id, | |
+ vlan=vlan, | |
+ should_create_vlan=should_create_vlan | |
) | |
network['subnets'] = subnets | |
port_profile = port.get('binding:profile') | |
diff --git a/virt/vmwareapi/vif.py b/virt/vmwareapi/vif.py | |
index 3d228d7..7c5841a 100644 | |
--- a/virt/vmwareapi/vif.py | |
+++ b/virt/vmwareapi/vif.py | |
@@ -151,6 +151,7 @@ def get_neutron_network(session, network_name, cluster, vif): | |
def get_network_ref(session, cluster, vif, is_neutron): | |
+ is_neutron = False | |
if is_neutron: | |
network_name = (vif['network']['bridge'] or | |
CONF.vmware.integration_bridge) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment