blob: 30e9480f2e2a027e4f563ce4190ef824ffef0576 [file] [log] [blame]
Ian Wienand5cdee8d2015-10-19 14:17:18 +11001#!/bin/bash
2
Doug Wiegley93e682c2015-03-03 10:31:30 -07003# Neutron loadbalancer plugin
4# ---------------------------
5
6# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +11007_XTRACE_NEUTRON_LB=$(set +o | grep xtrace)
Doug Wiegley93e682c2015-03-03 10:31:30 -07008set +o xtrace
9
10
11AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
12LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
13
14function neutron_agent_lbaas_install_agent_packages {
15 if is_ubuntu || is_fedora || is_suse; then
16 install_package haproxy
17 fi
18}
19
20function neutron_agent_lbaas_configure_common {
21 _neutron_service_plugin_class_add $LBAAS_PLUGIN
22 _neutron_deploy_rootwrap_filters $NEUTRON_LBAAS_DIR
23}
24
25function neutron_agent_lbaas_configure_agent {
26 LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
27 mkdir -p $LBAAS_AGENT_CONF_PATH
28
29 LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
30
Martin Hickey10bff0e2015-12-03 15:18:10 +000031 cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $LBAAS_AGENT_CONF_FILENAME
Doug Wiegley93e682c2015-03-03 10:31:30 -070032
33 # ovs_use_veth needs to be set before the plugin configuration
34 # occurs to allow plugins to override the setting.
35 iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
36
37 neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
38
39 if is_fedora; then
40 iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
41 iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
42 fi
43}
44
45function neutron_lbaas_stop {
46 pids=$(ps aux | awk '/haproxy/ { print $2 }')
Attila Fazekasf750a6f2015-07-01 12:17:35 +020047 [ ! -z "$pids" ] && sudo kill $pids || true
Doug Wiegley93e682c2015-03-03 10:31:30 -070048}
49
50# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +110051$_XTRACE_NEUTRON_LB