Browse code

Automate OVS bridge creation for multiple mappings

Allows the definition of the global variable OVS_BRIDGE_MAPPINGS (e.g.
in local.conf) to automatically trigger the creation of multiple OVS
bridges. For example:

OVS_BRIDGE_MAPPINGS=physnet1:br-br-enp0s20f1,physnet2:br-enp0s20f2

should automatically yield the creation of two bridges, respectively
associated to the two physical networks declared,
by simply running DevStack with the OVS agent enabled.

Documentation has also been added to doc/source/guides/neutron.rst.

Change-Id: I79dc0213c9d70ba628621c4c0f65481783590085
Closes-Bug: #1535835

Igor Duarte Cardoso authored on 2016/01/20 03:07:47
Showing 2 changed files
... ...
@@ -535,3 +535,19 @@ setup, with small modifications for the interface mappings.
535 535
     LB_PHYSICAL_INTERFACE=eth0
536 536
     PUBLIC_PHYSICAL_NETWORK=default
537 537
     LB_INTERFACE_MAPPINGS=default:eth0
538
+
539
+Creating specific OVS bridges for physical networks
540
+---------------------------------------------------
541
+
542
+When using the Open vSwitch ML2 mechanism driver, it is possible to
543
+have multiple Open vSwitch bridges meant for physical networking be
544
+automatically created by setting the ``OVS_BRIDGE_MAPPINGS`` to a list of
545
+physical network to bridge name associations with the following syntax:
546
+
547
+::
548
+    OVS_BRIDGE_MAPPINGS=net1name:bridge1name,net2name:bridge2name,<...>
549
+
550
+Also, ``OVS_BRIDGE_MAPPINGS`` has precedence over ``PHYSICAL_NETWORK`` and
551
+``OVS_PHYSICAL_BRIDGE``, meaning that if the former is set, the latter
552
+ones will be ignored. When ``OVS_BRIDGE_MAPPINGS`` is not set, the other
553
+variables will still be evaluated.
... ...
@@ -37,6 +37,7 @@ function neutron_plugin_configure_l3_agent {
37 37
 }
38 38
 
39 39
 function neutron_plugin_configure_plugin_agent {
40
+    local mappings_array mapping phys_bridge
40 41
     # Setup integration bridge
41 42
     _neutron_ovs_base_setup_bridge $OVS_BRIDGE
42 43
     _neutron_ovs_base_configure_firewall_driver
... ...
@@ -58,9 +59,15 @@ function neutron_plugin_configure_plugin_agent {
58 58
     # complex physical network configurations.
59 59
     if [[ "$OVS_BRIDGE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then
60 60
         OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE
61
+    fi
61 62
 
62
-        # Configure bridge manually with physical interface as port for multi-node
63
-        _neutron_ovs_base_add_bridge $OVS_PHYSICAL_BRIDGE
63
+    if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
64
+        IFS=',' read -a mappings_array <<< "$OVS_BRIDGE_MAPPINGS"
65
+        for mapping in "${mappings_array[@]}"; do
66
+            phys_bridge=`echo $mapping | cut -f 2 -d ":"`
67
+            # Configure bridge manually with physical interface as port for multi-node
68
+            _neutron_ovs_base_add_bridge $phys_bridge
69
+        done
64 70
     fi
65 71
     if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
66 72
         iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS