summaryrefslogtreecommitdiff
path: root/openstack-neutron.configure
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-04-14 13:00:50 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2015-04-16 04:09:41 +0000
commit65e059c107ffad30aed47e3c38774e8f33783089 (patch)
treea75bbc17b5b033f5663843f5de23dff11356b32e /openstack-neutron.configure
parent6170401ad901a02efec5558567719e6086f06005 (diff)
downloaddefinitions-65e059c107ffad30aed47e3c38774e8f33783089.tar.gz
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
Diffstat (limited to 'openstack-neutron.configure')
-rw-r--r--openstack-neutron.configure82
1 files changed, 69 insertions, 13 deletions
diff --git a/openstack-neutron.configure b/openstack-neutron.configure
index 50a6d1e4..04a0da5c 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,69 @@ 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
+ ;;
+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
##########################################################################