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 |
Dean Troyer | e3a9160 | 2014-03-28 12:40:56 -0500 | [diff] [blame] | 5 | LB_XTRACE=$(set +o | grep xtrace) |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 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" |
Kyle Mestery | 20b839f | 2014-12-08 06:17:27 +0000 | [diff] [blame^] | 10 | LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 11 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 12 | function neutron_agent_lbaas_install_agent_packages { |
Thomas Bechtold | cbd892b | 2014-09-24 14:50:45 +0200 | [diff] [blame] | 13 | if is_ubuntu || is_fedora || is_suse; then |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 14 | install_package haproxy |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 15 | fi |
| 16 | } |
| 17 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 18 | function neutron_agent_lbaas_configure_common { |
Isaku Yamahata | 9e136b4 | 2013-12-16 15:52:03 +0900 | [diff] [blame] | 19 | _neutron_service_plugin_class_add $LBAAS_PLUGIN |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 20 | } |
| 21 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 22 | function neutron_agent_lbaas_configure_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 23 | LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 24 | mkdir -p $LBAAS_AGENT_CONF_PATH |
| 25 | |
| 26 | LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini" |
| 27 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 28 | cp $NEUTRON_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 29 | |
Maru Newby | d7150e9 | 2013-04-23 06:16:11 +0000 | [diff] [blame] | 30 | # 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 McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 34 | neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 35 | |
| 36 | if is_fedora; then |
| 37 | iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody" |
Rabi Mishra | f2ca87a | 2014-02-21 20:08:28 +0530 | [diff] [blame] | 38 | iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody" |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 39 | fi |
| 40 | } |
| 41 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 42 | function neutron_lbaas_stop { |
Akihiro Motoki | edddb1f | 2013-12-09 20:21:06 +0900 | [diff] [blame] | 43 | pids=$(ps aux | awk '/haproxy/ { print $2 }') |
| 44 | [ ! -z "$pids" ] && sudo kill $pids |
| 45 | } |
| 46 | |
Eugene Nikanorov | b7d8284 | 2013-03-06 16:28:33 +0400 | [diff] [blame] | 47 | # Restore xtrace |
Dean Troyer | e3a9160 | 2014-03-28 12:40:56 -0500 | [diff] [blame] | 48 | $LB_XTRACE |