Browse code

Merge "Allow to use flat providernet for public network"

Jenkins authored on 2014/08/14 08:17:06
Showing 2 changed files
... ...
@@ -120,6 +120,21 @@ VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
120 120
 ## Provider Network Information
121 121
 PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"}
122 122
 
123
+# Use flat providernet for public network
124
+#
125
+# If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network
126
+# for external interface of neutron l3-agent.  In that case,
127
+# PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value
128
+# used for the network.  In case of openvswitch agent, you should
129
+# add the corresponding entry to your OVS_BRIDGE_MAPPINGS.
130
+#
131
+# eg.
132
+#    Q_USE_PROVIDERNET_FOR_PUBLIC=True
133
+#    PUBLIC_PHYSICAL_NETWORK=public
134
+#    OVS_BRIDGE_MAPPINGS=public:br-ex
135
+Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False}
136
+PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public}
137
+
123 138
 # The next two variables are configured by plugin
124 139
 # e.g.  _configure_neutron_l3_agent or lib/neutron_plugins/*
125 140
 #
... ...
@@ -446,7 +461,11 @@ function create_neutron_initial_network {
446 446
         fi
447 447
         neutron router-interface-add $ROUTER_ID $SUBNET_ID
448 448
         # Create an external network, and a subnet. Configure the external network as router gw
449
-        EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
449
+        if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
450
+            EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
451
+        else
452
+            EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
453
+        fi
450 454
         die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
451 455
         EXT_GW_IP=$(neutron subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
452 456
         die_if_not_set $LINENO EXT_GW_IP "Failure creating EXT_GW_IP"
... ...
@@ -71,7 +71,11 @@ function _neutron_ovs_base_configure_firewall_driver {
71 71
 }
72 72
 
73 73
 function _neutron_ovs_base_configure_l3_agent {
74
-    iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
74
+    if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
75
+        iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge ""
76
+    else
77
+        iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
78
+    fi
75 79
 
76 80
     neutron-ovs-cleanup
77 81
     # --no-wait causes a race condition if $PUBLIC_BRIDGE is not up when ip addr flush is called