From f1baa4ade17fcd1eaa2fed4aecf3901c414acc9a Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 14 Apr 2015 13:00:50 +0000 Subject: OpenStack: Split neutron config up into MANAGER, CONTROLLER and AGENT This adds NEUTRON_ENABLE_{MANAGER,CONTROLLER,AGENT} to determine which parts should be run on a node, so a network node has MANAGER enabled, but doesn't need CONTROLLER or AGENT, since those will be run on the controller and compute nodes respectively. This works by the configuration extension selectively enabling systemd units, with config-setup always being run, and db-setup run on the controller node. Rather than having the enable logic in 3 distinct setup services, their dependencies have been augmented to run after appropriate setup services if they are enabled, and to not run if their configuration hasn't been created. Change-Id: I7625074c94acfb49fc68660440609b0fe9c0052d --- openstack-neutron.configure | 83 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 13 deletions(-) (limited to 'openstack-neutron.configure') diff --git a/openstack-neutron.configure b/openstack-neutron.configure index 50a6d1e4..a0ab6b5f 100644 --- a/openstack-neutron.configure +++ b/openstack-neutron.configure @@ -18,19 +18,16 @@ set -e ROOT="$1" -########################################################################## - -ln -sf "/usr/lib/systemd/system/openstack-neutron-setup.service" \ - "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-neutron-setup.service" +enable(){ + ln -sf "/usr/lib/systemd/system/openstack-neutron-$1.service" \ + "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-neutron-$1.service" +} -############################################# -# Ensure /var/run is an appropriate symlink # -############################################# +unrecognised_value(){ + eval echo Unrecognised value \$$1 for $1 >&2 + exit 1 +} -if ! link="$(readlink "$ROOT/var/run")" || [ "$link" != ../run ]; then - rm -rf "$ROOT/var/run" - ln -s ../run "$ROOT/var/run" -fi ########################################################################## # Check variables @@ -51,7 +48,7 @@ if [ -z "$NEUTRON_SERVICE_USER" -a \ -z "$CONTROLLER_HOST_ADDRESS" -a \ -z "$MANAGEMENT_INTERFACE_IP_ADDRESS" -a \ -z "$KEYSTONE_TEMPORARY_ADMIN_TOKEN" ]; then - # No NOVA options defined, do nothing. + # No Neutron options defined, do nothing. exit 0 fi @@ -69,10 +66,70 @@ if [ -z "$NEUTRON_SERVICE_USER" -o \ -z "$CONTROLLER_HOST_ADDRESS" -o \ -z "$MANAGEMENT_INTERFACE_IP_ADDRESS" -o \ -z "$KEYSTONE_TEMPORARY_ADMIN_TOKEN" ]; then - echo Some options required for Nova were defined, but not all. + echo Some options required for Neutron were defined, but not all. exit 1 fi +############################################# +# Ensure /var/run is an appropriate symlink # +############################################# + +if ! link="$(readlink "$ROOT/var/run")" || [ "$link" != ../run ]; then + rm -rf "$ROOT/var/run" + ln -s ../run "$ROOT/var/run" +fi + +################### +# Enable services # +################### + +if [ x"${NEUTRON_ENABLE_CONTROLLER=True}" = xTrue -o \ + x"${NEUTRON_ENABLE_MANAGER=True}" = xTrue -o \ + x"${NEUTRON_ENABLE_AGENT=True}" = xTrue ]; then + enable config-setup +fi + +case "${NEUTRON_ENABLE_CONTROLLER}" in +True|yes|y) + enable config-setup + enable db-setup + enable server + ;; +False|no|n|'') + ;; +*) + unrecognised_value NEUTRON_ENABLE_CONTROLLER + ;; +esac + +case "${NEUTRON_ENABLE_MANAGER}" in +True|yes|y) + enable config-setup + enable ovs-cleanup + enable dhcp-agent + enable l3-agent + enable plugin-openvswitch-agent + enable metadata-agent + ;; +False|no|n|'') + ;; +*) + unrecognised_value NEUTRON_ENABLE_MANAGER + ;; +esac + +case "${NEUTRON_ENABLE_AGENT}" in +True|yes|y) + enable config-setup + enable plugin-openvswitch-agent + ;; +False|no|n|'') + ;; +*) + unrecognised_value NEUTRON_ENABLE_AGENT + ;; +esac + ########################################################################## # Generate config variable shell snippet ########################################################################## -- cgit v1.2.1