blob: c38f904b69ccc3590c238ef36ae81612dbfe040b [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
5MY_XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
8
Mark McClainb05c8762013-07-06 23:29:39 -04009AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
10LBAAS_PLUGIN=neutron.services.loadbalancer.plugin.LoadBalancerPlugin
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040011
Mark McClainb05c8762013-07-06 23:29:39 -040012function neutron_agent_lbaas_install_agent_packages() {
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040013 if is_ubuntu || is_fedora; then
14 install_package haproxy
Vincent Untz3f34d9a2013-03-12 17:57:36 +010015 elif is_suse; then
16 ### FIXME: Find out if package can be pushed to Factory
17 echo "HAProxy packages can be installed from server:http project in OBS"
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040018 fi
19}
20
Mark McClainb05c8762013-07-06 23:29:39 -040021function neutron_agent_lbaas_configure_common() {
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040022 if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
Eugene Nikanorovb7196172013-06-13 22:11:42 +040023 Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040024 else
Eugene Nikanorovb7196172013-06-13 22:11:42 +040025 Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN"
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040026 fi
27}
28
Mark McClainb05c8762013-07-06 23:29:39 -040029function neutron_agent_lbaas_configure_agent() {
30 LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040031 mkdir -p $LBAAS_AGENT_CONF_PATH
32
33 LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
34
Mark McClainb05c8762013-07-06 23:29:39 -040035 cp $NEUTRON_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040036
Maru Newbyd7150e92013-04-23 06:16:11 +000037 # ovs_use_veth needs to be set before the plugin configuration
38 # occurs to allow plugins to override the setting.
39 iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
40
Mark McClainb05c8762013-07-06 23:29:39 -040041 neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
Eugene Nikanorovb7d82842013-03-06 16:28:33 +040042
43 if is_fedora; then
44 iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
45 fi
46}
47
48# Restore xtrace
49$MY_XTRACE