Browse code

Fixes for linux bridge and Q_USE_PROVIDER_NET

===Set bridge_mappings for linux bridge===
The external network physnet needs a bridge_mapping to the public
bridge when the L2 agent is responsible for wiring.

===Add PUBLIC_PHYSICAL_NETWORK to flat_networks===
This network must be present in the ML2 flat_networks config if
flat_networks is specified.

===Set ext_gw_interface to PUBLIC_BRIDGE in provider net case===
ext_gw_interface must be a bridge in a bridge_mapping when
Q_USE_PROVIDERNET_FOR_PUBLIC is used.

Closes-Bug: #1605423
Change-Id: I95d63f8dfd21499c599d425678bf5327b599efcc

Kevin Benton authored on 2016/07/22 03:11:54
Showing 3 changed files
... ...
@@ -62,6 +62,9 @@ function neutron_plugin_configure_plugin_agent {
62 62
     if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
63 63
         LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
64 64
     fi
65
+    if [[ "$PUBLIC_BRIDGE" != "" ]] && [[ "$PUBLIC_PHYSICAL_NETWORK" != "" ]]; then
66
+        iniset /$Q_PLUGIN_CONF_FILE linux_bridge bridge_mappings "$PUBLIC_PHYSICAL_NETWORK:$PUBLIC_BRIDGE"
67
+    fi
65 68
     if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
66 69
         iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
67 70
     fi
... ...
@@ -95,8 +95,16 @@ function neutron_plugin_configure_service {
95 95
 
96 96
 
97 97
     # Allow for setup the flat type network
98
-    if [[ -z "$Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS" && -n "$PHYSICAL_NETWORK" ]]; then
99
-            Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS="flat_networks=$PHYSICAL_NETWORK"
98
+    if [[ -z "$Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS" ]]; then
99
+        if [[ -n "$PHYSICAL_NETWORK" || -n "$PUBLIC_PHYSICAL_NETWORK" ]]; then
100
+            Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS="flat_networks="
101
+            if [[ -n "$PHYSICAL_NETWORK" ]]; then
102
+                Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS+="${PHYSICAL_NETWORK},"
103
+            fi
104
+            if [[ -n "$PUBLIC_PHYSICAL_NETWORK" ]]; then
105
+                Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS+="${PUBLIC_PHYSICAL_NETWORK},"
106
+            fi
107
+        fi
100 108
     fi
101 109
     # REVISIT(rkukura): Setting firewall_driver here for
102 110
     # neutron.agent.securitygroups_rpc.is_firewall_enabled() which is
... ...
@@ -306,10 +306,15 @@ function _neutron_configure_router_v4 {
306 306
         if is_neutron_ovs_base_plugin; then
307 307
             ext_gw_interface=$(_neutron_get_ext_gw_interface)
308 308
         elif [[ "$Q_AGENT" = "linuxbridge" ]]; then
309
-            # Search for the brq device the neutron router and network for $FIXED_RANGE
309
+            # Get the device the neutron router and network for $FIXED_RANGE
310 310
             # will be using.
311
-            # e.x. brq3592e767-da for NET_ID 3592e767-da66-4bcb-9bec-cdb03cd96102
312
-            ext_gw_interface=brq${EXT_NET_ID:0:11}
311
+            if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
312
+                # in provider nets a bridge mapping uses the public bridge directly
313
+                ext_gw_interface=$PUBLIC_BRIDGE
314
+            else
315
+                # e.x. brq3592e767-da for NET_ID 3592e767-da66-4bcb-9bec-cdb03cd96102
316
+                ext_gw_interface=brq${EXT_NET_ID:0:11}
317
+            fi
313 318
         fi
314 319
         if [[ "$ext_gw_interface" != "none" ]]; then
315 320
             local cidr_len=${FLOATING_RANGE#*/}