From 48b7633ae84c5be77c6415d7f95ca696e4c0a2b6 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 16 Feb 2021 14:14:23 -0800 Subject: [PATCH] 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 --- lib/nova | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/nova b/lib/nova index 0a28cd97aa..6913040d26 100644 --- a/lib/nova +++ b/lib/nova @@ -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