Browse code

lib/neutron: Add a utility method to add service plugin

Partial-Bug: #1604664
Change-Id: I6d49ac188f7f1cfc8da314a26c9c5fc4b6d65bf4

YAMAMOTO Takashi authored on 2016/07/21 16:14:52
Showing 1 changed files
... ...
@@ -200,7 +200,7 @@ function configure_neutron_new {
200 200
     if is_service_enabled neutron-l3; then
201 201
         cp $NEUTRON_DIR/etc/l3_agent.ini.sample $NEUTRON_L3_CONF
202 202
         iniset $NEUTRON_L3_CONF DEFAULT interface_driver $NEUTRON_AGENT
203
-        iniset $NEUTRON_CONF DEFAULT service_plugins router
203
+        neutron_service_plugin_class_add router
204 204
         iniset $NEUTRON_L3_CONF agent root_helper_daemon "$NEUTRON_ROOTWRAP_DAEMON_CMD"
205 205
         iniset $NEUTRON_L3_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
206 206
         neutron_plugin_configure_l3_agent $NEUTRON_L3_CONF
... ...
@@ -249,14 +249,8 @@ function configure_neutron_new {
249 249
         source $TOP_DIR/lib/neutron_plugins/services/metering
250 250
         neutron_agent_metering_configure_common
251 251
         neutron_agent_metering_configure_agent
252
-        # TODO(sc68cal) hack because we don't pass around
253
-        # $Q_SERVICE_PLUGIN_CLASSES like -legacy does
254
-        local plugins=""
255
-        plugins=$(iniget $NEUTRON_CONF DEFAULT service_plugins)
256
-        plugins+=",metering"
257
-        iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
252
+        neutron_service_plugin_class_add metering
258 253
     fi
259
-
260 254
 }
261 255
 
262 256
 # configure_neutron_rootwrap() - configure Neutron's rootwrap
... ...
@@ -496,6 +490,16 @@ function _set_config_files {
496 496
 
497 497
 }
498 498
 
499
+# neutron_service_plugin_class_add() - add service plugin class
500
+function neutron_service_plugin_class_add_new {
501
+    local service_plugin_class=$1
502
+    local plugins=""
503
+
504
+    plugins=$(iniget $NEUTRON_CONF DEFAULT service_plugins)
505
+    plugins+=",${service_plugin_class}"
506
+    iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
507
+}
508
+
499 509
 # Dispatch functions
500 510
 # These are needed for compatibility between the old and new implementations
501 511
 # where there are function name overlaps.  These will be removed when
... ...
@@ -555,6 +559,15 @@ function install_neutron {
555 555
     fi
556 556
 }
557 557
 
558
+function neutron_service_plugin_class_add {
559
+    if is_neutron_legacy_enabled; then
560
+        # Call back to old function
561
+        _neutron_service_plugin_class_add "$@"
562
+    else
563
+        neutron_service_plugin_class_add_new "$@"
564
+    fi
565
+}
566
+
558 567
 function start_neutron {
559 568
     if is_neutron_legacy_enabled; then
560 569
         # Call back to old function