Browse code

Revert change to remove lbaas from devstack; it breaks grenade.

Change-Id: Ie2adaeb7f27d6d646ca2e6e575fb430b9b74b276

Doug Wiegley authored on 2015/03/04 02:31:30
Showing 4 changed files
... ...
@@ -1601,25 +1601,6 @@ function enable_plugin {
1601 1601
     GITBRANCH[$name]=$branch
1602 1602
 }
1603 1603
 
1604
-# is_plugin_enabled
1605
-#
1606
-# Has a particular plugin been enabled?
1607
-function is_plugin_enabled {
1608
-    local plugins=$@
1609
-    local plugin
1610
-    local enabled=1
1611
-
1612
-    # short circuit if nothing to do
1613
-    if [[ -z ${DEVSTACK_PLUGINS} ]]; then
1614
-        return $enabled
1615
-    fi
1616
-
1617
-    for plugin in ${plugins}; do
1618
-        [[ ,${DEVSTACK_PLUGINS}, =~ ,${plugin}, ]] && enabled=0
1619
-    done
1620
-    return $enabled
1621
-}
1622
-
1623 1604
 # fetch_plugins
1624 1605
 #
1625 1606
 # clones all plugins
... ...
@@ -100,8 +100,10 @@ IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-fe80:cafe:cafe::1}
100 100
 # Set up default directories
101 101
 GITDIR["python-neutronclient"]=$DEST/python-neutronclient
102 102
 
103
+
103 104
 NEUTRON_DIR=$DEST/neutron
104 105
 NEUTRON_FWAAS_DIR=$DEST/neutron-fwaas
106
+NEUTRON_LBAAS_DIR=$DEST/neutron-lbaas
105 107
 NEUTRON_VPNAAS_DIR=$DEST/neutron-vpnaas
106 108
 NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
107 109
 
... ...
@@ -114,7 +116,6 @@ fi
114 114
 
115 115
 NEUTRON_CONF_DIR=/etc/neutron
116 116
 NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
117
-
118 117
 export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
119 118
 
120 119
 # Agent binaries.  Note, binary paths for other agents are set in per-service
... ...
@@ -325,6 +326,12 @@ ENABLE_METADATA_NETWORK=${ENABLE_METADATA_NETWORK:-False}
325 325
 # Please refer to ``lib/neutron_plugins/README.md`` for details.
326 326
 source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
327 327
 
328
+# Agent loadbalancer service plugin functions
329
+# -------------------------------------------
330
+
331
+# Hardcoding for 1 service plugin for now
332
+source $TOP_DIR/lib/neutron_plugins/services/loadbalancer
333
+
328 334
 # Agent metering service plugin functions
329 335
 # -------------------------------------------
330 336
 
... ...
@@ -351,17 +358,6 @@ fi
351 351
 TEMPEST_SERVICES+=,neutron
352 352
 
353 353
 
354
-# For backward compatibility, if q-lbaas service is enabled, make sure to load the
355
-# neutron-lbaas plugin.  This hook should be removed in a future release, perhaps
356
-# as early as Liberty.
357
-
358
-if is_service_enabled q-lbaas; then
359
-    if ! is_plugin_enabled neutron-lbaas; then
360
-        DEPRECATED_TEXT+="External plugin neutron-lbaas has been automatically activated, please add the appropriate enable_plugin to your local.conf. This will be removed in the Liberty cycle."
361
-        enable_plugin "neutron-lbaas" ${NEUTRON_LBAAS_REPO} ${NEUTRON_LBAAS_BRANCH}
362
-    fi
363
-fi
364
-
365 354
 # Save trace setting
366 355
 XTRACE=$(set +o | grep xtrace)
367 356
 set +o xtrace
... ...
@@ -429,7 +425,9 @@ function configure_neutron {
429 429
     iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT
430 430
 
431 431
     # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
432
-
432
+    if is_service_enabled q-lbaas; then
433
+        _configure_neutron_lbaas
434
+    fi
433 435
     if is_service_enabled q-metering; then
434 436
         _configure_neutron_metering
435 437
     fi
... ...
@@ -607,8 +605,7 @@ function init_neutron {
607 607
     recreate_database $Q_DB_NAME
608 608
     # Run Neutron db migrations
609 609
     $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
610
-
611
-    for svc in fwaas vpnaas; do
610
+    for svc in fwaas lbaas vpnaas; do
612 611
         if [ "$svc" = "vpnaas" ]; then
613 612
             q_svc="q-vpn"
614 613
         else
... ...
@@ -628,6 +625,10 @@ function install_neutron {
628 628
         git_clone $NEUTRON_FWAAS_REPO $NEUTRON_FWAAS_DIR $NEUTRON_FWAAS_BRANCH
629 629
         setup_develop $NEUTRON_FWAAS_DIR
630 630
     fi
631
+    if is_service_enabled q-lbaas; then
632
+        git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH
633
+        setup_develop $NEUTRON_LBAAS_DIR
634
+    fi
631 635
     if is_service_enabled q-vpn; then
632 636
         git_clone $NEUTRON_VPNAAS_REPO $NEUTRON_VPNAAS_DIR $NEUTRON_VPNAAS_BRANCH
633 637
         setup_develop $NEUTRON_VPNAAS_DIR
... ...
@@ -671,6 +672,10 @@ function install_neutron_agent_packages {
671 671
     if is_service_enabled q-agt q-dhcp q-l3; then
672 672
         neutron_plugin_install_agent_packages
673 673
     fi
674
+
675
+    if is_service_enabled q-lbaas; then
676
+        neutron_agent_lbaas_install_agent_packages
677
+    fi
674 678
 }
675 679
 
676 680
 # Start running processes, including screen
... ...
@@ -730,6 +735,10 @@ function start_neutron_agents {
730 730
         run_process q-domua "python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU"
731 731
     fi
732 732
 
733
+    if is_service_enabled q-lbaas; then
734
+        run_process q-lbaas "python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME"
735
+    fi
736
+
733 737
     if is_service_enabled q-metering; then
734 738
         run_process q-metering "python $AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
735 739
     fi
... ...
@@ -753,6 +762,9 @@ function stop_neutron {
753 753
 
754 754
     stop_process q-agt
755 755
 
756
+    if is_service_enabled q-lbaas; then
757
+        neutron_lbaas_stop
758
+    fi
756 759
     if is_service_enabled q-fwaas; then
757 760
         neutron_fwaas_stop
758 761
     fi
... ...
@@ -780,11 +792,12 @@ function cleanup_neutron {
780 780
     fi
781 781
 
782 782
     # delete all namespaces created by neutron
783
-    for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|fip|snat)-[0-9a-f-]*'); do
783
+    for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do
784 784
         sudo ip netns delete ${ns}
785 785
     done
786 786
 }
787 787
 
788
+
788 789
 function _create_neutron_conf_dir {
789 790
     # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find
790 791
     if [[ ! -d $NEUTRON_CONF_DIR ]]; then
... ...
@@ -954,6 +967,14 @@ function _configure_neutron_ceilometer_notifications {
954 954
     iniset $NEUTRON_CONF DEFAULT notification_driver messaging
955 955
 }
956 956
 
957
+function _configure_neutron_lbaas {
958
+    if [ -f $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf ]; then
959
+        cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf $NEUTRON_CONF_DIR
960
+    fi
961
+    neutron_agent_lbaas_configure_common
962
+    neutron_agent_lbaas_configure_agent
963
+}
964
+
957 965
 function _configure_neutron_metering {
958 966
     neutron_agent_metering_configure_common
959 967
     neutron_agent_metering_configure_agent
960 968
new file mode 100644
... ...
@@ -0,0 +1,49 @@
0
+# Neutron loadbalancer plugin
1
+# ---------------------------
2
+
3
+# Save trace setting
4
+LB_XTRACE=$(set +o | grep xtrace)
5
+set +o xtrace
6
+
7
+
8
+AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
9
+LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
10
+
11
+function neutron_agent_lbaas_install_agent_packages {
12
+    if is_ubuntu || is_fedora || is_suse; then
13
+        install_package haproxy
14
+    fi
15
+}
16
+
17
+function neutron_agent_lbaas_configure_common {
18
+    _neutron_service_plugin_class_add $LBAAS_PLUGIN
19
+    _neutron_deploy_rootwrap_filters $NEUTRON_LBAAS_DIR
20
+}
21
+
22
+function neutron_agent_lbaas_configure_agent {
23
+    LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
24
+    mkdir -p $LBAAS_AGENT_CONF_PATH
25
+
26
+    LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
27
+
28
+    cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME
29
+
30
+    # ovs_use_veth needs to be set before the plugin configuration
31
+    # occurs to allow plugins to override the setting.
32
+    iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
33
+
34
+    neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
35
+
36
+    if is_fedora; then
37
+        iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
38
+        iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
39
+    fi
40
+}
41
+
42
+function neutron_lbaas_stop {
43
+    pids=$(ps aux | awk '/haproxy/ { print $2 }')
44
+    [ ! -z "$pids" ] && sudo kill $pids
45
+}
46
+
47
+# Restore xtrace
48
+$LB_XTRACE
... ...
@@ -198,9 +198,6 @@ NEUTRON_FWAAS_REPO=${NEUTRON_FWAAS_REPO:-${GIT_BASE}/openstack/neutron-fwaas.git
198 198
 NEUTRON_FWAAS_BRANCH=${NEUTRON_FWAAS_BRANCH:-master}
199 199
 
200 200
 # neutron lbaas service
201
-# The neutron-lbaas specific entries are deprecated and replaced by the neutron-lbaas
202
-# devstack plugin and should be removed in a future release, possibly as soon as Liberty.
203
-
204 201
 NEUTRON_LBAAS_REPO=${NEUTRON_LBAAS_REPO:-${GIT_BASE}/openstack/neutron-lbaas.git}
205 202
 NEUTRON_LBAAS_BRANCH=${NEUTRON_LBAAS_BRANCH:-master}
206 203