Add devstack plugin for neutron-lbaas
The devstack team has implemented a plugin method so that individual projects can deliver their devstack setup code in their own repositories. Change-Id: I64a94aeeabe6357b5ea7796e34c9306c55c9ae67
This commit is contained in:
parent
acc87a1f42
commit
966d9a7999
44
devstack/README.md
Normal file
44
devstack/README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
This directory contains the neutron-lbaas devstack plugin. To
|
||||||
|
configure the neutron load balancer, in the [[local|localrc]] section,
|
||||||
|
you will need to enable the neutron-lbaas devstack plugin and enable
|
||||||
|
the LBaaS service by editing the [[local|localrc]] section of your
|
||||||
|
local.conf file.
|
||||||
|
|
||||||
|
1) Enable the plugin
|
||||||
|
|
||||||
|
To enable the plugin, add a line of the form:
|
||||||
|
|
||||||
|
enable_plugin neutron-lbaas <GITURL> [GITREF]
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
<GITURL> is the URL of a neutron-lbaas repository
|
||||||
|
[GITREF] is an optional git ref (branch/ref/tag). The default is
|
||||||
|
master.
|
||||||
|
|
||||||
|
For example
|
||||||
|
|
||||||
|
enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/kilo
|
||||||
|
|
||||||
|
2) Enable the LBaaS service
|
||||||
|
|
||||||
|
To enable the LBaaS service, add a line of the form:
|
||||||
|
|
||||||
|
|
||||||
|
ENABLED_SERVICES+=<LBAAS-FLAG>
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
<LBAAS-FLAG> is "q-lbaasv1" for LBaaS Version 1, or "q-lbaasv2"
|
||||||
|
for LBaaS Version 2. "q-lbaas" is synonymous with
|
||||||
|
"q-lbaasv1".
|
||||||
|
|
||||||
|
to the [[local|localrc]] section of local.conf
|
||||||
|
|
||||||
|
For example
|
||||||
|
|
||||||
|
# For LBaaS V2
|
||||||
|
ENABLED_SERVICES+=q-lbaasv2
|
||||||
|
|
||||||
|
For more information, see the "Externally Hosted Plugins" section of
|
||||||
|
http://docs.openstack.org/developer/devstack/plugins.html.
|
108
devstack/plugin.sh
Normal file
108
devstack/plugin.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
# function definitions for neutron-lbaas devstack plugin
|
||||||
|
|
||||||
|
function neutron_lbaas_install {
|
||||||
|
setup_develop $NEUTRON_LBAAS_DIR
|
||||||
|
neutron_agent_lbaas_install_agent_packages
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_agent_lbaas_install_agent_packages {
|
||||||
|
if is_ubuntu || is_fedora || is_suse; then
|
||||||
|
install_package haproxy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_configure_common {
|
||||||
|
if is_service_enabled $LBAAS_V1 && is_service_enabled $LBAAS_V2; then
|
||||||
|
die $LINENO "Do not enable both Version 1 and Version 2 of LBaaS."
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf $NEUTRON_LBAAS_CONF
|
||||||
|
|
||||||
|
if is_service_enabled $LBAAS_V2; then
|
||||||
|
inicomment $NEUTRON_LBAAS_CONF service_providers service_provider
|
||||||
|
iniadd $NEUTRON_LBAAS_CONF service_providers service_provider\
|
||||||
|
"LOADBALANCERV2:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.synchronous_namespace_driver.HaproxyNSDriver:default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_service_enabled $LBAAS_V1; then
|
||||||
|
_neutron_service_plugin_class_add $LBAASV1_PLUGIN
|
||||||
|
iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES
|
||||||
|
elif is_service_enabled $LBAAS_V2; then
|
||||||
|
_neutron_service_plugin_class_add $LBAASV2_PLUGIN
|
||||||
|
iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES
|
||||||
|
fi
|
||||||
|
|
||||||
|
_neutron_deploy_rootwrap_filters $NEUTRON_LBAAS_DIR
|
||||||
|
|
||||||
|
$NEUTRON_BIN_DIR/neutron-db-manage --service lbaas --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_configure_agent {
|
||||||
|
mkdir -p $LBAAS_AGENT_CONF_PATH
|
||||||
|
cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME
|
||||||
|
|
||||||
|
# ovs_use_veth needs to be set before the plugin configuration
|
||||||
|
# occurs to allow plugins to override the setting.
|
||||||
|
iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
|
||||||
|
|
||||||
|
neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
|
||||||
|
|
||||||
|
if is_fedora; then
|
||||||
|
iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
|
||||||
|
iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_start {
|
||||||
|
run_process q-lbaas "python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file $LBAAS_AGENT_CONF_FILENAME --config-file=$LBAAS_AGENT_CONF_FILENAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_stop {
|
||||||
|
pids=$(ps aux | awk '/haproxy/ { print $2 }')
|
||||||
|
[ ! -z "$pids" ] && sudo kill $pids
|
||||||
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_cleanup {
|
||||||
|
|
||||||
|
# delete all namespaces created by neutron-lbaas
|
||||||
|
|
||||||
|
for ns in $(sudo ip netns list | grep -o -E '(qlbaas|nlbaas)-[0-9a-f-]*'); do
|
||||||
|
sudo ip netns delete ${ns}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for service enabled
|
||||||
|
if is_service_enabled $LBAAS_ANY; then
|
||||||
|
|
||||||
|
if ! is_service_enabled q-svc; then
|
||||||
|
die "The neutron q-svc service must be enabled to use $LBAAS_ANY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||||
|
# Perform installation of service source
|
||||||
|
echo_summary "Installing neutron-lbaas"
|
||||||
|
neutron_lbaas_install
|
||||||
|
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||||
|
# Configure after the other layer 1 and 2 services have been configured
|
||||||
|
echo_summary "Configuring neutron-lbaas"
|
||||||
|
neutron_lbaas_configure_common
|
||||||
|
neutron_lbaas_configure_agent
|
||||||
|
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||||
|
# Initialize and start the LBaaS service
|
||||||
|
echo_summary "Initializing neutron-lbaas"
|
||||||
|
neutron_lbaas_start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "unstack" ]]; then
|
||||||
|
# Shut down LBaaS services
|
||||||
|
neutron_lbaas_stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "clean" ]]; then
|
||||||
|
# Remove state and transient data
|
||||||
|
# Remember clean.sh first calls unstack.sh
|
||||||
|
neutron_lbaas_cleanup
|
||||||
|
fi
|
19
devstack/settings
Normal file
19
devstack/settings
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# settings for LBaaS devstack pluginlib/neutron_plugins/services/loadbalancer
|
||||||
|
|
||||||
|
# For backward compatibility, treat q-lbaas and q-lbaasv1 the same.
|
||||||
|
# In the future, the q-lbaas may default to q-lbaasv2
|
||||||
|
|
||||||
|
AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
|
||||||
|
|
||||||
|
LBAAS_V1="q-lbaas q-lbaasv1"
|
||||||
|
LBAAS_V2="q-lbaasv2"
|
||||||
|
LBAAS_ANY="$LBAAS_V1 $LBAAS_V2"
|
||||||
|
|
||||||
|
LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
|
||||||
|
LBAAS_AGENT_CONF_FILENAME=$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini
|
||||||
|
|
||||||
|
LBAASV1_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
|
||||||
|
LBAASV2_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
|
||||||
|
|
||||||
|
NEUTRON_LBAAS_DIR=$DEST/neutron-lbaas
|
||||||
|
NEUTRON_LBAAS_CONF=$NEUTRON_CONF_DIR/neutron_lbaas.conf
|
Loading…
Reference in New Issue
Block a user