From 3095ff51320291b3622cacc3bf2fb1043bff8d31 Mon Sep 17 00:00:00 2001 From: Igor Duarte Cardoso Date: Tue, 19 Jan 2016 18:07:47 +0000 Subject: [PATCH] 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 --- doc/source/guides/neutron.rst | 16 ++++++++++++++++ lib/neutron_plugins/openvswitch_agent | 11 +++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/source/guides/neutron.rst b/doc/source/guides/neutron.rst index 1e20d7fcbe..be85b63580 100644 --- a/doc/source/guides/neutron.rst +++ b/doc/source/guides/neutron.rst @@ -535,3 +535,19 @@ setup, with small modifications for the interface mappings. LB_PHYSICAL_INTERFACE=eth0 PUBLIC_PHYSICAL_NETWORK=default LB_INTERFACE_MAPPINGS=default:eth0 + +Creating specific OVS bridges for physical networks +--------------------------------------------------- + +When using the Open vSwitch ML2 mechanism driver, it is possible to +have multiple Open vSwitch bridges meant for physical networking be +automatically created by setting the ``OVS_BRIDGE_MAPPINGS`` to a list of +physical network to bridge name associations with the following syntax: + +:: + OVS_BRIDGE_MAPPINGS=net1name:bridge1name,net2name:bridge2name,<...> + +Also, ``OVS_BRIDGE_MAPPINGS`` has precedence over ``PHYSICAL_NETWORK`` and +``OVS_PHYSICAL_BRIDGE``, meaning that if the former is set, the latter +ones will be ignored. When ``OVS_BRIDGE_MAPPINGS`` is not set, the other +variables will still be evaluated. diff --git a/lib/neutron_plugins/openvswitch_agent b/lib/neutron_plugins/openvswitch_agent index b1acacd4f3..94a26898ad 100644 --- a/lib/neutron_plugins/openvswitch_agent +++ b/lib/neutron_plugins/openvswitch_agent @@ -37,6 +37,7 @@ function neutron_plugin_configure_l3_agent { } function neutron_plugin_configure_plugin_agent { + local mappings_array mapping phys_bridge # Setup integration bridge _neutron_ovs_base_setup_bridge $OVS_BRIDGE _neutron_ovs_base_configure_firewall_driver @@ -58,9 +59,15 @@ function neutron_plugin_configure_plugin_agent { # complex physical network configurations. if [[ "$OVS_BRIDGE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE + fi - # Configure bridge manually with physical interface as port for multi-node - _neutron_ovs_base_add_bridge $OVS_PHYSICAL_BRIDGE + if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then + IFS=',' read -a mappings_array <<< "$OVS_BRIDGE_MAPPINGS" + for mapping in "${mappings_array[@]}"; do + phys_bridge=`echo $mapping | cut -f 2 -d ":"` + # Configure bridge manually with physical interface as port for multi-node + _neutron_ovs_base_add_bridge $phys_bridge + done fi if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS