Fix cellsv2 cell0 database name

For some reason we were defaulting the name of the cell0 database
to nova_api_cell0 instead of nova_cell0. Devstack inherited that to
make things work, but we don't really want that. This patch makes us
use the proper name and create the cell0 mapping accordingly. As a
side effect, it also starts the process of unifying the cellsv1 and
cellsv2 paths by creating the cell0 mapping the same for both.

This is the grenade side of I4e7f6c5eaa068c98e5c4ef3feaee50d8e4f5d484.

The related Nova change which depends on this is:

I86797785f76c2c927a4db8fef72b8f8d986af6b9

We have to change the from-update/upgrade-nova script to explicitly
call map_cell0 so we can control the database connection used to
workaround the bug being fixed in that Nova change.

Related-Bug: #1656673

Change-Id: Ifdcd6a572dc0b42ba852241e22f6713cd2b084b0
This commit is contained in:
Dan Smith 2017-01-15 10:39:50 -08:00 committed by Matt Riedemann
parent 1bc3d889c1
commit 74ce189956
3 changed files with 9 additions and 2 deletions

View File

@ -3,6 +3,6 @@ function configure_nova_upgrade() {
source $TARGET_DEVSTACK_DIR/lib/database
# We need to create the cell0 database before we can sync it
initialize_database_backends
recreate_database nova_api_cell0
recreate_database nova_cell0
fi
}

View File

@ -5,6 +5,12 @@ function configure_nova_upgrade() {
# Perform an unconditional simple setup of the cells v2 models and mappings
# We need to create the cell0 database before we can sync it
initialize_database_backends
recreate_database nova_api_cell0
recreate_database nova_cell0
# NOTE: We use map_cell0 to create the cell0 mapping with the main
# database connection URL directly since simple_cell_setup was incorrectly
# using the api_database connection for this in Newton. As long as the
# cell0 mapping exists before simple_cell_setup is called it will not be
# re-created.
($NOVA_BIN_DIR/nova-manage cell_v2 map_cell0 --database_connection $(database_connection_url nova_cell0) || true)
$NOVA_BIN_DIR/nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
}

View File

@ -75,6 +75,7 @@ fi
# Setup cellsv2 records, if necessary.
if [ "$NOVA_CONFIGURE_CELLSV2" == "True" ]; then
($NOVA_BIN_DIR/nova-manage cell_v2 map_cell0 --database_connection $(database_connection_url nova_cell0) || true)
$NOVA_BIN_DIR/nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
fi