blob: bd9dc8731ba9acdf1bceef189d02c7d5b3063c7a [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# Neutron loadbalancer plugin
Eugene Nikanorovb7d82842013-03-06 16:28:33 +04002# ---------------------------
3
4# Save trace setting
Dean Troyere3a91602014-03-28 12:40:56 -05005LB_XTRACE=$(set +o | grep xtrace)
Eugene Nikanorovb7d82842013-03-06 16:28:33 +04006set +o xtrace
7
8
Mark McClainb05c8762013-07-06 23:29:39 -04009AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
Kyle Mestery20b839f2014-12-08 06:17:27 +000010LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040011
Ian Wienandaee18c72014-02-21 15:35:08 +110012function neutron_agent_lbaas_install_agent_packages {
Thomas Bechtoldcbd892b2014-09-24 14:50:45 +020013 if is_ubuntu || is_fedora || is_suse; then
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040014 install_package haproxy
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040015 fi
16}
17
Ian Wienandaee18c72014-02-21 15:35:08 +110018function neutron_agent_lbaas_configure_common {
Isaku Yamahata9e136b42013-12-16 15:52:03 +090019 _neutron_service_plugin_class_add $LBAAS_PLUGIN
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040020}
21
Ian Wienandaee18c72014-02-21 15:35:08 +110022function neutron_agent_lbaas_configure_agent {
Mark McClainb05c8762013-07-06 23:29:39 -040023 LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040024 mkdir -p $LBAAS_AGENT_CONF_PATH
25
26 LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
27
Mark McClainb05c8762013-07-06 23:29:39 -040028 cp $NEUTRON_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040029
Maru Newbyd7150e92013-04-23 06:16:11 +000030 # 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
Mark McClainb05c8762013-07-06 23:29:39 -040034 neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040035
36 if is_fedora; then
37 iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
Rabi Mishraf2ca87a2014-02-21 20:08:28 +053038 iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040039 fi
40}
41
Ian Wienandaee18c72014-02-21 15:35:08 +110042function neutron_lbaas_stop {
Akihiro Motokiedddb1f2013-12-09 20:21:06 +090043 pids=$(ps aux | awk '/haproxy/ { print $2 }')
44 [ ! -z "$pids" ] && sudo kill $pids
45}
46
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040047# Restore xtrace
Dean Troyere3a91602014-03-28 12:40:56 -050048$LB_XTRACE