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
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-17 15:35:24 +0000
commitf1baa4ade17fcd1eaa2fed4aecf3901c414acc9a (patch)
tree64c52a84fb808aa6853d583a53e46c98b7f1b35c /openstack-neutron.configure
parentda6201b2e28b41a55547941ed181f2a6b413e61d (diff)
downloaddefinitions-f1baa4ade17fcd1eaa2fed4aecf3901c414acc9a.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.configure83
1 files changed, 70 insertions, 13 deletions
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
##########################################################################