Browse code

Revert "WIP - Remove lbaas from devstack proper"

The WIP prefix and the statement

"This can't merge until p-c no longer references lbaas jobs."

Should have been an indication that this patch is not quite ready to
go in as is.

This reverts commit 130c3adb0e88044c9cf3789e79f6e669fa30d7d2.

Change-Id: I57d5f9f2e66b1bdf6fca70074bc1d5678de65f38

Armando Migliaccio authored on 2016/04/14 08:28:06
Showing 3 changed files
... ...
@@ -107,6 +107,7 @@ GITDIR["python-neutronclient"]=$DEST/python-neutronclient
107 107
 
108 108
 NEUTRON_DIR=$DEST/neutron
109 109
 NEUTRON_FWAAS_DIR=$DEST/neutron-fwaas
110
+NEUTRON_LBAAS_DIR=$DEST/neutron-lbaas
110 111
 NEUTRON_VPNAAS_DIR=$DEST/neutron-vpnaas
111 112
 NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
112 113
 
... ...
@@ -121,6 +122,9 @@ NEUTRON_CONF_DIR=/etc/neutron
121 121
 NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
122 122
 export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
123 123
 
124
+# Default provider for load balancer service
125
+DEFAULT_LB_PROVIDER=LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
126
+
124 127
 # Default provider for VPN service
125 128
 DEFAULT_VPN_PROVIDER=VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default
126 129
 
... ...
@@ -343,6 +347,12 @@ if [ -f $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN ]; then
343 343
     source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
344 344
 fi
345 345
 
346
+# Agent loadbalancer service plugin functions
347
+# -------------------------------------------
348
+
349
+# Hardcoding for 1 service plugin for now
350
+source $TOP_DIR/lib/neutron_plugins/services/loadbalancer
351
+
346 352
 # Agent metering service plugin functions
347 353
 # -------------------------------------------
348 354
 
... ...
@@ -432,6 +442,10 @@ function configure_neutron {
432 432
     iniset_rpc_backend neutron $NEUTRON_CONF
433 433
 
434 434
     # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
435
+    if is_service_enabled q-lbaas; then
436
+        deprecated "Configuring q-lbaas through devstack is deprecated"
437
+        _configure_neutron_lbaas
438
+    fi
435 439
     if is_service_enabled q-metering; then
436 440
         _configure_neutron_metering
437 441
     fi
... ...
@@ -642,6 +656,10 @@ function install_neutron {
642 642
         git_clone $NEUTRON_FWAAS_REPO $NEUTRON_FWAAS_DIR $NEUTRON_FWAAS_BRANCH
643 643
         setup_develop $NEUTRON_FWAAS_DIR
644 644
     fi
645
+    if is_service_enabled q-lbaas; then
646
+        git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH
647
+        setup_develop $NEUTRON_LBAAS_DIR
648
+    fi
645 649
     if is_service_enabled q-vpn; then
646 650
         git_clone $NEUTRON_VPNAAS_REPO $NEUTRON_VPNAAS_DIR $NEUTRON_VPNAAS_BRANCH
647 651
         setup_develop $NEUTRON_VPNAAS_DIR
... ...
@@ -685,6 +703,10 @@ function install_neutron_agent_packages {
685 685
     if is_service_enabled q-agt q-dhcp q-l3; then
686 686
         neutron_plugin_install_agent_packages
687 687
     fi
688
+
689
+    if is_service_enabled q-lbaas; then
690
+        neutron_agent_lbaas_install_agent_packages
691
+    fi
688 692
 }
689 693
 
690 694
 # Start running processes, including screen
... ...
@@ -747,6 +769,7 @@ function start_neutron_other_agents {
747 747
     fi
748 748
 
749 749
     run_process q-meta "$AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE"
750
+    run_process q-lbaas "$AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME"
750 751
     run_process q-metering "$AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
751 752
 
752 753
     if [ "$VIRT_DRIVER" = 'xenserver' ]; then
... ...
@@ -785,6 +808,9 @@ function stop_neutron_other {
785 785
         stop_process q-meta
786 786
     fi
787 787
 
788
+    if is_service_enabled q-lbaas; then
789
+        neutron_lbaas_stop
790
+    fi
788 791
     if is_service_enabled q-fwaas; then
789 792
         neutron_fwaas_stop
790 793
     fi
... ...
@@ -889,7 +915,7 @@ function cleanup_neutron {
889 889
     fi
890 890
 
891 891
     # delete all namespaces created by neutron
892
-    for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|fip|snat)-[0-9a-f-]*'); do
892
+    for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do
893 893
         sudo ip netns delete ${ns}
894 894
     done
895 895
 }
... ...
@@ -1082,6 +1108,18 @@ function _configure_neutron_ceilometer_notifications {
1082 1082
     iniset $NEUTRON_CONF oslo_messaging_notifications driver messaging
1083 1083
 }
1084 1084
 
1085
+function _configure_neutron_lbaas {
1086
+    # Uses oslo config generator to generate LBaaS sample configuration files
1087
+    (cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh)
1088
+
1089
+    if [ -f $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample ]; then
1090
+        cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_CONF_DIR/neutron_lbaas.conf
1091
+        iniset $NEUTRON_CONF_DIR/neutron_lbaas.conf service_providers service_provider $DEFAULT_LB_PROVIDER
1092
+    fi
1093
+    neutron_agent_lbaas_configure_common
1094
+    neutron_agent_lbaas_configure_agent
1095
+}
1096
+
1085 1097
 function _configure_neutron_metering {
1086 1098
     neutron_agent_metering_configure_common
1087 1099
     neutron_agent_metering_configure_agent
1088 1100
new file mode 100644
... ...
@@ -0,0 +1,51 @@
0
+#!/bin/bash
1
+
2
+# Neutron loadbalancer plugin
3
+# ---------------------------
4
+
5
+# Save trace setting
6
+_XTRACE_NEUTRON_LB=$(set +o | grep xtrace)
7
+set +o xtrace
8
+
9
+
10
+AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
11
+LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
12
+
13
+function neutron_agent_lbaas_install_agent_packages {
14
+    if is_ubuntu || is_fedora || is_suse; then
15
+        install_package haproxy
16
+    fi
17
+}
18
+
19
+function neutron_agent_lbaas_configure_common {
20
+    _neutron_service_plugin_class_add $LBAAS_PLUGIN
21
+    _neutron_deploy_rootwrap_filters $NEUTRON_LBAAS_DIR
22
+}
23
+
24
+function neutron_agent_lbaas_configure_agent {
25
+    LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
26
+    mkdir -p $LBAAS_AGENT_CONF_PATH
27
+
28
+    LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
29
+
30
+    cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $LBAAS_AGENT_CONF_FILENAME
31
+
32
+    # ovs_use_veth needs to be set before the plugin configuration
33
+    # occurs to allow plugins to override the setting.
34
+    iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
35
+
36
+    neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
37
+
38
+    if is_fedora; then
39
+        iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
40
+        iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
41
+    fi
42
+}
43
+
44
+function neutron_lbaas_stop {
45
+    pids=$(ps aux | awk '/haproxy/ { print $2 }')
46
+    [ ! -z "$pids" ] && sudo kill $pids || true
47
+}
48
+
49
+# Restore xtrace
50
+$_XTRACE_NEUTRON_LB
... ...
@@ -231,6 +231,10 @@ NEUTRON_BRANCH=${NEUTRON_BRANCH:-master}
231 231
 NEUTRON_FWAAS_REPO=${NEUTRON_FWAAS_REPO:-${GIT_BASE}/openstack/neutron-fwaas.git}
232 232
 NEUTRON_FWAAS_BRANCH=${NEUTRON_FWAAS_BRANCH:-master}
233 233
 
234
+# neutron lbaas service
235
+NEUTRON_LBAAS_REPO=${NEUTRON_LBAAS_REPO:-${GIT_BASE}/openstack/neutron-lbaas.git}
236
+NEUTRON_LBAAS_BRANCH=${NEUTRON_LBAAS_BRANCH:-master}
237
+
234 238
 # neutron vpnaas service
235 239
 NEUTRON_VPNAAS_REPO=${NEUTRON_VPNAAS_REPO:-${GIT_BASE}/openstack/neutron-vpnaas.git}
236 240
 NEUTRON_VPNAAS_BRANCH=${NEUTRON_VPNAAS_BRANCH:-master}