Browse code

Merge "Fixes for linux bridge and Q_USE_PROVIDER_NET"

Jenkins authored on 2016/08/18 21:30:28
Showing 3 changed files
... ...
@@ -61,6 +61,9 @@ function neutron_plugin_configure_plugin_agent {
61 61
     if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
62 62
         LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
63 63
     fi
64
+    if [[ "$PUBLIC_BRIDGE" != "" ]] && [[ "$PUBLIC_PHYSICAL_NETWORK" != "" ]]; then
65
+        iniset /$Q_PLUGIN_CONF_FILE linux_bridge bridge_mappings "$PUBLIC_PHYSICAL_NETWORK:$PUBLIC_BRIDGE"
66
+    fi
64 67
     if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
65 68
         iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
66 69
     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#*/}