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
This commit is contained in:
Chris Dent 2018-04-25 13:01:03 +01:00
parent 24fa317234
commit e8bad5cd6a
2 changed files with 12 additions and 10 deletions

View File

@ -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
}

View File

@ -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
# ====================