Browse code

lib/neutron: allow to add more ml2 extension drivers

The patch will allow jobs to append new ml2 extension drivers without
overriding port_security.

Change-Id: I45f017d1b8a3054452c3166ed4fb460d21959adb

Ihar Hrachyshka authored on 2017/03/07 15:31:49
Showing 2 changed files
... ...
@@ -163,7 +163,7 @@ function configure_neutron_new {
163 163
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
164 164
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks public
165 165
         if [[ "$NEUTRON_PORT_SECURITY" = "True" ]]; then
166
-            iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers port_security
166
+            neutron_ml2_extension_driver_add port_security
167 167
         fi
168 168
     fi
169 169
 
... ...
@@ -481,6 +481,18 @@ function neutron_service_plugin_class_add_new {
481 481
     iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
482 482
 }
483 483
 
484
+function _neutron_ml2_extension_driver_add {
485
+    local driver=$1
486
+    local drivers=""
487
+
488
+    drivers=$(iniget $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers)
489
+    if [ $drivers ]; then
490
+        drivers+=","
491
+    fi
492
+    drivers+="${driver}"
493
+    iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers $drivers
494
+}
495
+
484 496
 function neutron_server_config_add_new {
485 497
     _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS+=($1)
486 498
 }
... ...
@@ -553,6 +565,15 @@ function neutron_service_plugin_class_add {
553 553
     fi
554 554
 }
555 555
 
556
+function neutron_ml2_extension_driver_add {
557
+    if is_neutron_legacy_enabled; then
558
+        # Call back to old function
559
+        _neutron_ml2_extension_driver_add_old "$@"
560
+    else
561
+        _neutron_ml2_extension_driver_add "$@"
562
+    fi
563
+}
564
+
556 565
 function install_neutron_agent_packages {
557 566
     if is_neutron_legacy_enabled; then
558 567
         # Call back to old function
... ...
@@ -870,6 +870,16 @@ function _neutron_service_plugin_class_add {
870 870
     fi
871 871
 }
872 872
 
873
+# _neutron_ml2_extension_driver_add_old() - add ML2 extension driver
874
+function _neutron_ml2_extension_driver_add_old {
875
+    local extension=$1
876
+    if [[ $Q_ML2_PLUGIN_EXT_DRIVERS == '' ]]; then
877
+        Q_ML2_PLUGIN_EXT_DRIVERS=$extension
878
+    elif [[ ! ,${Q_ML2_PLUGIN_EXT_DRIVERS}, =~ ,${extension}, ]]; then
879
+        Q_ML2_PLUGIN_EXT_DRIVERS="$Q_ML2_PLUGIN_EXT_DRIVERS,$extension"
880
+    fi
881
+}
882
+
873 883
 # mutnauq_server_config_add() - add server config file
874 884
 function mutnauq_server_config_add {
875 885
     _Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($1)