Browse code

Merge "Neutron: Define a utility function to add neutron service class"

Jenkins authored on 2014/01/01 22:28:32
Showing 6 changed files
... ...
@@ -757,6 +757,16 @@ function _configure_neutron_service() {
757 757
 # Utility Functions
758 758
 #------------------
759 759
 
760
+# _neutron_service_plugin_class_add() - add service plugin class
761
+function _neutron_service_plugin_class_add() {
762
+    local service_plugin_class=$1
763
+    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
764
+        Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class
765
+    elif [[ ! ,${Q_SERVICE_PLUGIN_CLASSES}, =~ ,${service_plugin_class}, ]]; then
766
+        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$service_plugin_class"
767
+    fi
768
+}
769
+
760 770
 # _neutron_setup_rootwrap() - configure Neutron's rootwrap
761 771
 function _neutron_setup_rootwrap() {
762 772
     if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
... ...
@@ -54,11 +54,7 @@ function neutron_plugin_configure_common() {
54 54
     Q_PLUGIN_CLASS="neutron.plugins.ml2.plugin.Ml2Plugin"
55 55
     # The ML2 plugin delegates L3 routing/NAT functionality to
56 56
     # the L3 service plugin which must therefore be specified.
57
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
58
-        Q_SERVICE_PLUGIN_CLASSES=$ML2_L3_PLUGIN
59
-    else
60
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$ML2_L3_PLUGIN"
61
-    fi
57
+    _neutron_service_plugin_class_add $ML2_L3_PLUGIN
62 58
 }
63 59
 
64 60
 function neutron_plugin_configure_service() {
... ...
@@ -8,11 +8,7 @@ set +o xtrace
8 8
 FWAAS_PLUGIN=neutron.services.firewall.fwaas_plugin.FirewallPlugin
9 9
 
10 10
 function neutron_fwaas_configure_common() {
11
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
12
-        Q_SERVICE_PLUGIN_CLASSES=$FWAAS_PLUGIN
13
-    else
14
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$FWAAS_PLUGIN"
15
-    fi
11
+    _neutron_service_plugin_class_add $FWAAS_PLUGIN
16 12
 }
17 13
 
18 14
 function neutron_fwaas_configure_driver() {
... ...
@@ -19,11 +19,7 @@ function neutron_agent_lbaas_install_agent_packages() {
19 19
 }
20 20
 
21 21
 function neutron_agent_lbaas_configure_common() {
22
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
23
-        Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN
24
-    else
25
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN"
26
-    fi
22
+    _neutron_service_plugin_class_add $LBAAS_PLUGIN
27 23
 }
28 24
 
29 25
 function neutron_agent_lbaas_configure_agent() {
... ...
@@ -10,11 +10,7 @@ AGENT_METERING_BINARY="$NEUTRON_BIN_DIR/neutron-metering-agent"
10 10
 METERING_PLUGIN="neutron.services.metering.metering_plugin.MeteringPlugin"
11 11
 
12 12
 function neutron_agent_metering_configure_common() {
13
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
14
-        Q_SERVICE_PLUGIN_CLASSES=$METERING_PLUGIN
15
-    else
16
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$METERING_PLUGIN"
17
-    fi
13
+    _neutron_service_plugin_class_add $METERING_PLUGIN
18 14
 }
19 15
 
20 16
 function neutron_agent_metering_configure_agent() {
... ...
@@ -15,11 +15,7 @@ function neutron_vpn_install_agent_packages() {
15 15
 }
16 16
 
17 17
 function neutron_vpn_configure_common() {
18
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
19
-        Q_SERVICE_PLUGIN_CLASSES=$VPN_PLUGIN
20
-    else
21
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$VPN_PLUGIN"
22
-    fi
18
+    _neutron_service_plugin_class_add $VPN_PLUGIN
23 19
 }
24 20
 
25 21
 function neutron_vpn_stop() {