Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # Neutron loadbalancer plugin |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 2 | # --------------------------- |
| 3 | |
| 4 | # Save trace setting |
| 5 | MY_XTRACE=$(set +o | grep xtrace) |
| 6 | set +o xtrace |
| 7 | |
| 8 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 9 | AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent" |
| 10 | LBAAS_PLUGIN=neutron.services.loadbalancer.plugin.LoadBalancerPlugin |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 11 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 12 | function neutron_agent_lbaas_install_agent_packages() { |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 13 | if is_ubuntu || is_fedora; then |
| 14 | install_package haproxy |
Vincent Untz | 3f34d9a | 2013-03-12 17:57:36 +0100 | [diff] [blame] | 15 | 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 Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 18 | fi |
| 19 | } |
| 20 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 21 | function neutron_agent_lbaas_configure_common() { |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 22 | if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then |
Eugene Nikanorov | b719617 | 2013-06-13 22:11:42 +0400 | [diff] [blame] | 23 | Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 24 | else |
Eugene Nikanorov | b719617 | 2013-06-13 22:11:42 +0400 | [diff] [blame] | 25 | Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN" |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 26 | fi |
| 27 | } |
| 28 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 29 | function neutron_agent_lbaas_configure_agent() { |
| 30 | LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 31 | mkdir -p $LBAAS_AGENT_CONF_PATH |
| 32 | |
| 33 | LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini" |
| 34 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 35 | cp $NEUTRON_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 36 | |
Maru Newby | d7150e9 | 2013-04-23 06:16:11 +0000 | [diff] [blame] | 37 | # 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 McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 41 | neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 42 | |
| 43 | if is_fedora; then |
| 44 | iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody" |
| 45 | fi |
| 46 | } |
| 47 | |
Akihiro Motoki | edddb1f | 2013-12-09 20:21:06 +0900 | [diff] [blame^] | 48 | function neutron_lbaas_stop() { |
| 49 | pids=$(ps aux | awk '/haproxy/ { print $2 }') |
| 50 | [ ! -z "$pids" ] && sudo kill $pids |
| 51 | } |
| 52 | |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 53 | # Restore xtrace |
| 54 | $MY_XTRACE |