Add LBaaS in the lab scripts

This patch adds support to enable neutron LBaaS support in the
training guide's OpenStack installation.

Changes made are as follows

* Pre-download neutron-lbaas-agent to base disk
* Enable LBaaS support on horizon on controller node
* Configure neutron server to support LBaaS with haproxy as provider
  on controller node
* Enable and configure LBaaS agent on network node

Change-Id: I35f8c19ebceb7420f735354337bf71b4d92edf93
Closes-Bug: 1414767
This commit is contained in:
Vigneshvar.A.S 2015-01-28 13:20:17 +05:30 committed by Roger Luethi
parent 8a58c765de
commit 3bcbd1ec26
5 changed files with 103 additions and 1 deletions

@ -20,5 +20,7 @@ cmd queue setup_horizon.sh
cmd snapshot_cycle horizon_installed
cmd queue config_external_network.sh
cmd queue config_tenant_network.sh
cmd snapshot_cycle openstack_networks_configured
cmd queue setup_lbaas_controller.sh
cmd snapshot_cycle controller_node_installed
cmd boot

@ -4,6 +4,8 @@ cmd queue etc_hosts.sh
cmd queue osbash/enable_vagrant_ssh_keys.sh
cmd snapshot_cycle network_configured
cmd queue setup_neutron_network.sh
cmd snapshot_cycle neutron_configured
cmd queue setup_lbaas_network.sh
cmd snapshot_cycle network_node_installed
# Take snapshot of changes on controller VM, too
cmd queue shutdown_controller.sh

@ -61,7 +61,7 @@ apt_download nova-api nova-cert nova-conductor nova-consoleauth \
nova-novncproxy nova-scheduler python-novaclient
# Neutron Controller
apt_download neutron-server neutron-plugin-ml2
apt_download neutron-server neutron-plugin-ml2 neutron-lbaas-agent
# Cinder Controller
apt_download cinder-api cinder-scheduler

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/credentials"
source "$LIB_DIR/functions.guest"
source "$CONFIG_DIR/admin-openstackrc.sh"
exec_logfile
indicate_current_auto
#------------------------------------------------------------------------------
# Set up OpenStack neutron LBaaS for controller node.
# http://docs.openstack.org/admin-guide-cloud/content/install_neutron-lbaas-agent.html
#------------------------------------------------------------------------------
echo "Configuring neutron lbaas for controller node."
conf=/etc/neutron/neutron.conf
# Configure network plugin parameters
iniset_sudo $conf DEFAULT service_plugins "router,lbaas"
echo "Restarting neutron service."
sudo service neutron-server restart
# Configure openstack dashboard
function check_dashboard_settings {
local memcached_conf=/etc/memcached.conf
local dashboard_conf=/etc/openstack-dashboard/local_settings.py
# Enabling Neutron LBaaS on Horizon
echo "Enabling neutron LBaaS on horizon."
sudo sed -i "s/'enable_lb': False/\'enable_lb\': True/" $dashboard_conf
}
echo "Checking dashboard configuration."
check_dashboard_settings
echo "Reloading apache and memcached service."
sudo service apache2 restart
sudo service memcached restart

@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/credentials"
source "$LIB_DIR/functions.guest"
source "$CONFIG_DIR/openstack"
exec_logfile
indicate_current_auto
#------------------------------------------------------------------------------
# Set up OpenStack neutron LBaaS for network node.
# http://docs.openstack.org/admin-guide-cloud/content/install_neutron-lbaas-agent.html
#------------------------------------------------------------------------------
echo "Installing neutron lbaas agent for network node."
sudo apt-get install -y neutron-lbaas-agent
echo "Configuring LBaaS agent for network node."
conf=/etc/neutron/lbaas_agent.ini
iniset_sudo $conf DEFAULT device_driver neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
iniset_sudo $conf DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
echo "Restarting the neutron lbaas agent service."
sudo service neutron-lbaas-agent restart
#------------------------------------------------------------------------------
# Verify the neutron LBaaS installation
#------------------------------------------------------------------------------
echo "Verifying neutron lbaas installation."
echo "Waiting for neutron-lbaas-agent to start."
AUTH="source $CONFIG_DIR/demo-openstackrc.sh"
until node_ssh controller-mgmt "$AUTH; neutron lb-pool-list" >/dev/null 2>&1; do
sleep 1
done
LB_NUMBER=$(date +"%d%m%y%H%M%S")
echo "neutron lb-pool-create --lb-method ROUND_ROBIN --name test-lb$LB_NUMBER --protocol HTTP --subnet-id demo-subnet"
node_ssh controller-mgmt "$AUTH; neutron lb-pool-create --lb-method ROUND_ROBIN --name test-lb$LB_NUMBER --protocol HTTP --subnet-id demo-subnet"
echo "Checking if created pool is active."
until node_ssh controller-mgmt "$AUTH; neutron lb-pool-list | grep test-lb$LB_NUMBER | grep -i ACTIVE" > /dev/null 2>&1; do
sleep 1
done
echo "Success."
echo "neutron lb-pool-list"
node_ssh controller-mgmt "$AUTH; neutron lb-pool-list"
echo "neutron lb-pool-delete test-lb$LB_NUMBER"
node_ssh controller-mgmt "$AUTH; neutron lb-pool-delete test-lb$LB_NUMBER"
echo "neutron lb-pool-list"
node_ssh controller-mgmt "$AUTH; neutron lb-pool-list"