| ... | ... |
@@ -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 |
| ... | ... |
@@ -643,6 +657,10 @@ function install_neutron {
|
| 643 | 643 |
git_clone $NEUTRON_FWAAS_REPO $NEUTRON_FWAAS_DIR $NEUTRON_FWAAS_BRANCH |
| 644 | 644 |
setup_develop $NEUTRON_FWAAS_DIR |
| 645 | 645 |
fi |
| 646 |
+ if is_service_enabled q-lbaas; then |
|
| 647 |
+ git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH |
|
| 648 |
+ setup_develop $NEUTRON_LBAAS_DIR |
|
| 649 |
+ fi |
|
| 646 | 650 |
if is_service_enabled q-vpn; then |
| 647 | 651 |
git_clone $NEUTRON_VPNAAS_REPO $NEUTRON_VPNAAS_DIR $NEUTRON_VPNAAS_BRANCH |
| 648 | 652 |
setup_develop $NEUTRON_VPNAAS_DIR |
| ... | ... |
@@ -686,6 +704,10 @@ function install_neutron_agent_packages {
|
| 686 | 686 |
if is_service_enabled q-agt q-dhcp q-l3; then |
| 687 | 687 |
neutron_plugin_install_agent_packages |
| 688 | 688 |
fi |
| 689 |
+ |
|
| 690 |
+ if is_service_enabled q-lbaas; then |
|
| 691 |
+ neutron_agent_lbaas_install_agent_packages |
|
| 692 |
+ fi |
|
| 689 | 693 |
} |
| 690 | 694 |
|
| 691 | 695 |
# Start running processes, including screen |
| ... | ... |
@@ -748,6 +770,7 @@ function start_neutron_other_agents {
|
| 748 | 748 |
fi |
| 749 | 749 |
|
| 750 | 750 |
run_process q-meta "$AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE" |
| 751 |
+ run_process q-lbaas "$AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" |
|
| 751 | 752 |
run_process q-metering "$AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME" |
| 752 | 753 |
|
| 753 | 754 |
if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
| ... | ... |
@@ -786,6 +809,9 @@ function stop_neutron_other {
|
| 786 | 786 |
stop_process q-meta |
| 787 | 787 |
fi |
| 788 | 788 |
|
| 789 |
+ if is_service_enabled q-lbaas; then |
|
| 790 |
+ neutron_lbaas_stop |
|
| 791 |
+ fi |
|
| 789 | 792 |
if is_service_enabled q-fwaas; then |
| 790 | 793 |
neutron_fwaas_stop |
| 791 | 794 |
fi |
| ... | ... |
@@ -890,7 +916,7 @@ function cleanup_neutron {
|
| 890 | 890 |
fi |
| 891 | 891 |
|
| 892 | 892 |
# delete all namespaces created by neutron |
| 893 |
- for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|fip|snat)-[0-9a-f-]*'); do |
|
| 893 |
+ for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do |
|
| 894 | 894 |
sudo ip netns delete ${ns}
|
| 895 | 895 |
done |
| 896 | 896 |
} |
| ... | ... |
@@ -1083,6 +1109,18 @@ function _configure_neutron_ceilometer_notifications {
|
| 1083 | 1083 |
iniset $NEUTRON_CONF oslo_messaging_notifications driver messaging |
| 1084 | 1084 |
} |
| 1085 | 1085 |
|
| 1086 |
+function _configure_neutron_lbaas {
|
|
| 1087 |
+ # Uses oslo config generator to generate LBaaS sample configuration files |
|
| 1088 |
+ (cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh) |
|
| 1089 |
+ |
|
| 1090 |
+ if [ -f $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample ]; then |
|
| 1091 |
+ cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_CONF_DIR/neutron_lbaas.conf |
|
| 1092 |
+ iniset $NEUTRON_CONF_DIR/neutron_lbaas.conf service_providers service_provider $DEFAULT_LB_PROVIDER |
|
| 1093 |
+ fi |
|
| 1094 |
+ neutron_agent_lbaas_configure_common |
|
| 1095 |
+ neutron_agent_lbaas_configure_agent |
|
| 1096 |
+} |
|
| 1097 |
+ |
|
| 1086 | 1098 |
function _configure_neutron_metering {
|
| 1087 | 1099 |
neutron_agent_metering_configure_common |
| 1088 | 1100 |
neutron_agent_metering_configure_agent |
| 1089 | 1101 |
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 |
| ... | ... |
@@ -238,6 +238,10 @@ NEUTRON_BRANCH=${NEUTRON_BRANCH:-master}
|
| 238 | 238 |
NEUTRON_FWAAS_REPO=${NEUTRON_FWAAS_REPO:-${GIT_BASE}/openstack/neutron-fwaas.git}
|
| 239 | 239 |
NEUTRON_FWAAS_BRANCH=${NEUTRON_FWAAS_BRANCH:-master}
|
| 240 | 240 |
|
| 241 |
+# neutron lbaas service |
|
| 242 |
+NEUTRON_LBAAS_REPO=${NEUTRON_LBAAS_REPO:-${GIT_BASE}/openstack/neutron-lbaas.git}
|
|
| 243 |
+NEUTRON_LBAAS_BRANCH=${NEUTRON_LBAAS_BRANCH:-master}
|
|
| 244 |
+ |
|
| 241 | 245 |
# neutron vpnaas service |
| 242 | 246 |
NEUTRON_VPNAAS_REPO=${NEUTRON_VPNAAS_REPO:-${GIT_BASE}/openstack/neutron-vpnaas.git}
|
| 243 | 247 |
NEUTRON_VPNAAS_BRANCH=${NEUTRON_VPNAAS_BRANCH:-master}
|