Fix nova db dependency

When I reordered the nova database creation for better performance
and cleaner arrangement, I broke the non-standard arrangement where
the super and cell conductors are squashed together. In devstack,
this is implemented by pointing the controllers at cell1 in the
config, which makes it hard to create and sync the databases in the
natural order. This manifested in a failure when running in this
mode (which apparently Trove is).

As a quick fix, this special-cases the setup for cell0 if that mode
is enabled. I will follow this up with a cleaner refactor of all that
stuff so this hack isn't required, but that will take a bit longer.

Change-Id: I5385157c281beb041bf67cba546be20cf9497cbe
This commit is contained in:
Dan Smith 2021-02-16 14:14:23 -08:00
parent 556f84aea9
commit 48b7633ae8
1 changed files with 16 additions and 1 deletions

View File

@ -754,7 +754,17 @@ function init_nova {
# Only do this step once on the API node for an entire cluster.
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then
# (Re)create nova databases
async_run nova-cell-0 init_nova_db nova_cell0 $NOVA_CONF
if [[ "$CELLSV2_SETUP" == "singleconductor" ]]; then
# If we are doing singleconductor mode, we have some strange
# interdependencies. in that the main config refers to cell1
# instead of cell0. In that case, just make sure the cell0 database
# is created before we need it below, but don't db_sync it until
# after the cellN databases are there.
recreate_database nova_cell0
else
async_run nova-cell-0 init_nova_db nova_cell0 $NOVA_CONF
fi
for i in $(seq 1 $NOVA_NUM_CELLS); do
async_run nova-cell-$i init_nova_db nova_cell${i} $(conductor_conf $i)
done
@ -771,6 +781,11 @@ function init_nova {
async_wait nova-cell-$i
done
if [[ "$CELLSV2_SETUP" == "singleconductor" ]]; then
# We didn't db sync cell0 above, so run it now
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync
fi
# Run online migrations on the new databases
# Needed for flavor conversion
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations