Browse code

Add DVR support to lib/neutron

Added NEUTRON_DISTRIBUTED_ROUTING to more easily control DVR
configuration. If set to True, DVR will be enabled and the
default agent mode will be set to 'dvr_snat' since that works
with all types of routers by default. Advanced users can
override that by setting NEUTRON_DVR_MODE, for example in
multi-node configurations where different agent modes are
desired.

This should bring lib/neutron inline with lib/neutron-legacy
in supporting all the different DVR modes.

Change-Id: I9f25921eefc5b935aad3bb1edc5e41ee0ce43a84

Brian Haley authored on 2017/09/21 03:23:05
Showing 1 changed files
... ...
@@ -32,6 +32,17 @@ NEUTRON_AGENT=${NEUTRON_AGENT:-openvswitch}
32 32
 NEUTRON_DIR=$DEST/neutron
33 33
 NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
34 34
 
35
+NEUTRON_DISTRIBUTED_ROUTING=$(trueorfalse False NEUTRON_DISTRIBUTED_ROUTING)
36
+# Distributed Virtual Router (DVR) configuration
37
+# Can be:
38
+# - ``legacy``          - No DVR functionality
39
+# - ``dvr_snat``        - Controller or single node DVR
40
+# - ``dvr``             - Compute node in multi-node DVR
41
+# - ``dvr_no_external`` - Compute node in multi-node DVR, no external network
42
+#
43
+# Default is 'dvr_snat' since it can handle both DVR and legacy routers
44
+NEUTRON_DVR_MODE=${NEUTRON_DVR_MODE:-dvr_snat}
45
+
35 46
 NEUTRON_BIN_DIR=$(get_python_exec_prefix)
36 47
 NEUTRON_DHCP_BINARY="neutron-dhcp-agent"
37 48
 
... ...
@@ -173,6 +184,7 @@ function configure_neutron_new {
173 173
 
174 174
         iniset $NEUTRON_CONF DEFAULT policy_file $policy_file
175 175
         iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips True
176
+        iniset $NEUTRON_CONF DEFAULT router_distributed $NEUTRON_DISTRIBUTED_ROUTING
176 177
 
177 178
         iniset $NEUTRON_CONF DEFAULT auth_strategy $NEUTRON_AUTH_STRATEGY
178 179
         configure_auth_token_middleware $NEUTRON_CONF neutron $NEUTRON_AUTH_CACHE_DIR keystone_authtoken
... ...
@@ -181,7 +193,15 @@ function configure_neutron_new {
181 181
         # Configure VXLAN
182 182
         # TODO(sc68cal) not hardcode?
183 183
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2 tenant_network_types vxlan
184
-        iniset $NEUTRON_CORE_PLUGIN_CONF ml2 mechanism_drivers openvswitch,linuxbridge
184
+
185
+        local mech_drivers="openvswitch"
186
+        if [[ "$NEUTRON_DISTRIBUTED_ROUTING" = "True" ]]; then
187
+            mech_drivers+=",l2population"
188
+        else
189
+            mech_drivers+=",linuxbridge"
190
+        fi
191
+        iniset $NEUTRON_CORE_PLUGIN_CONF ml2 mechanism_drivers $mech_drivers
192
+
185 193
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
186 194
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks public
187 195
         if [[ "$NEUTRON_PORT_SECURITY" = "True" ]]; then
... ...
@@ -202,6 +222,11 @@ function configure_neutron_new {
202 202
         else
203 203
             iniset $NEUTRON_CORE_PLUGIN_CONF securitygroup firewall_driver iptables_hybrid
204 204
             iniset $NEUTRON_CORE_PLUGIN_CONF ovs local_ip $HOST_IP
205
+
206
+            if [[ "$NEUTRON_DISTRIBUTED_ROUTING" = "True" ]]; then
207
+                iniset $NEUTRON_CORE_PLUGIN_CONF agent l2_population True
208
+                iniset $NEUTRON_CORE_PLUGIN_CONF agent enable_distributed_routing True
209
+            fi
205 210
         fi
206 211
 
207 212
         if ! running_in_container; then
... ...
@@ -236,6 +261,10 @@ function configure_neutron_new {
236 236
         else
237 237
             iniset $NEUTRON_CORE_PLUGIN_CONF ovs bridge_mappings "$PUBLIC_NETWORK_NAME:$PUBLIC_BRIDGE"
238 238
         fi
239
+
240
+        if [[ "$NEUTRON_DISTRIBUTED_ROUTING" = "True" ]]; then
241
+            iniset $NEUTRON_L3_CONF DEFAULT agent_mode $NEUTRON_DVR_MODE
242
+        fi
239 243
     fi
240 244
 
241 245
     # Metadata