Browse code

Merge "lib/neutron: allow to add more ml2 extension drivers"

Jenkins authored on 2017/03/29 01:15:58
Showing 2 changed files
... ...
@@ -171,7 +171,7 @@ function configure_neutron_new {
171 171
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
172 172
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks public
173 173
         if [[ "$NEUTRON_PORT_SECURITY" = "True" ]]; then
174
-            iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers port_security
174
+            neutron_ml2_extension_driver_add port_security
175 175
         fi
176 176
     fi
177 177
 
... ...
@@ -489,6 +489,18 @@ function neutron_service_plugin_class_add_new {
489 489
     iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
490 490
 }
491 491
 
492
+function _neutron_ml2_extension_driver_add {
493
+    local driver=$1
494
+    local drivers=""
495
+
496
+    drivers=$(iniget $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers)
497
+    if [ $drivers ]; then
498
+        drivers+=","
499
+    fi
500
+    drivers+="${driver}"
501
+    iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers $drivers
502
+}
503
+
492 504
 function neutron_server_config_add_new {
493 505
     _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS+=($1)
494 506
 }
... ...
@@ -561,6 +573,15 @@ function neutron_service_plugin_class_add {
561 561
     fi
562 562
 }
563 563
 
564
+function neutron_ml2_extension_driver_add {
565
+    if is_neutron_legacy_enabled; then
566
+        # Call back to old function
567
+        _neutron_ml2_extension_driver_add_old "$@"
568
+    else
569
+        _neutron_ml2_extension_driver_add "$@"
570
+    fi
571
+}
572
+
564 573
 function install_neutron_agent_packages {
565 574
     if is_neutron_legacy_enabled; then
566 575
         # 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)