From e8bad5cd6a65821c54d66bbc5f7ba17091439d34 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Wed, 25 Apr 2018 13:01:03 +0100 Subject: [PATCH] Init placement before nova With change I7e1e89cd66397883453935dcf7172d977bf82e84 the placement service may optionally use its own database. In order for this to work, however, the ordering of how both nova and placement are configured and initialized in stack.sh requires careful control. * nova.conf must be created first * then placement must make some adjustments to it * then lib/placement needs to create the placement database * before nova does a database sync (of both databases) Otherwise, when the placement_database/connection is defined, the nova db_sync command will fail because the placement database does not yet exist. If we try to do a sync before the nova_api database is created _that_ sync will fail. This patch adjusts the ordering and also removes a comment that will no longer be true when I7e1e89cd66397883453935dcf7172d977bf82e84 is merged. Change-Id: Id5b5911c04d198fe7b94c7d827afeb5cdf43a076 --- lib/placement | 8 +++----- stack.sh | 14 +++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/placement b/lib/placement index 1d68f8a185..d70596734c 100644 --- a/lib/placement +++ b/lib/placement @@ -44,8 +44,6 @@ PLACEMENT_UWSGI_CONF=$PLACEMENT_CONF_DIR/placement-uwsgi.ini # The placement service can optionally use a separate database # connection. Set PLACEMENT_DB_ENABLED to True to use it. -# NOTE(cdent): This functionality depends on some code that is not -# yet merged in nova but is coming soon. PLACEMENT_DB_ENABLED=$(trueorfalse False PLACEMENT_DB_ENABLED) if is_service_enabled tls-proxy; then @@ -152,9 +150,9 @@ function create_placement_accounts { function init_placement { if [ "$PLACEMENT_DB_ENABLED" != False ]; then recreate_database placement - time_start "dbsync" - $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync - time_stop "dbsync" + # Database migration will be handled when nova does an api_db sync + # TODO(cdent): When placement is extracted we'll do our own sync + # here. fi create_placement_accounts } diff --git a/stack.sh b/stack.sh index 6899fa0d8b..30f24b6a3f 100755 --- a/stack.sh +++ b/stack.sh @@ -894,6 +894,8 @@ if is_service_enabled neutron; then stack_install_service neutron fi +# Nova configuration is used by placement so we need to create nova.conf +# first. if is_service_enabled nova; then # Compute service stack_install_service nova @@ -1184,6 +1186,13 @@ if is_service_enabled cinder; then init_cinder fi +# Placement Service +# --------------- + +if is_service_enabled placement; then + echo_summary "Configuring placement" + init_placement +fi # Compute Service # --------------- @@ -1202,11 +1211,6 @@ if is_service_enabled nova; then init_nova_cells fi -if is_service_enabled placement; then - echo_summary "Configuring placement" - init_placement -fi - # Extras Configuration # ====================