Create cell1 cell before n-api starts

Change ac5fdb4c40 introduced
a problem for gnocchi CI because the deployments steps
are now:

1. create cell0
2. start nova-api (with multiple workers)
3. install ceilometer via extras
4. ceilometer calls nova-api to list servers; at this point
   nova-api getes the list of cells and caches them, which
   will just be cell0
5. create cell1 via simple_cell_setup which also discovers
   the n-cpu node so we can schedule instances
6. gnocchi tests create and list instances and at this point it hits
   an n-api worker that only has cell0 cached so it does not
   find some test servers it created and fails.

The cell0 and cell1 cells should be created in the nova_api db
before starting n-api so that when we first list instances, we
store both cells in the cache that's in n-api. This deployment
order is also how the nova docs describe rolling out cells v2
but the way we were doing this devstack wasn't following that,
or accounting for when devstack plugins are loaded via extras.

This change creates the main cell1 cell earlier in the setup
before n-api is started, and then changes to just run
discover_hosts at the end after n-cpu is running (which is what
simple_cell_setup and map_cell_and_hosts would do implicitly).

Change-Id: I38eab6707340253a10159a169ae61d34784c2d28
Related-Bug: #1669473
This commit is contained in:
Matt Riedemann 2017-03-02 12:45:47 -05:00
parent 23d03b697f
commit f15224c740
2 changed files with 9 additions and 12 deletions

View File

@ -664,6 +664,10 @@ function init_nova_cells {
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF cell create --name=region --cell_type=parent --username=$RABBIT_USERID --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=/ --woffset=0 --wscale=1
$NOVA_BIN_DIR/nova-manage cell create --name=child --cell_type=child --username=$RABBIT_USERID --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=child_cell --woffset=0 --wscale=1
# Creates the single cells v2 cell for the child cell (v1) nova db.
nova-manage --config-file $NOVA_CELLS_CONF cell_v2 create_cell \
--transport-url $(get_transport_url child_cell) --name 'cell1'
fi
}
@ -720,6 +724,10 @@ function init_nova {
# Run online migrations on the new databases
# Needed for flavor conversion
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations
# create the cell1 cell for the main nova db where the hosts live
nova-manage cell_v2 create_cell --transport-url $(get_transport_url) \
--name 'cell1'
fi
create_nova_cache_dir
@ -968,17 +976,6 @@ function create_flavors {
fi
}
# create_cell(): Group the available hosts into a cell
function create_cell {
if ! is_service_enabled n-cell; then
nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
else
nova-manage --config-file $NOVA_CELLS_CONF --verbose cell_v2 map_cell_and_hosts \
--transport-url $(get_transport_url child_cell) --name 'cell1'
nova-manage db sync
fi
}
# Restore xtrace
$_XTRACE_LIB_NOVA

View File

@ -1364,7 +1364,7 @@ check_libs_from_git
# Do this late because it requires compute hosts to have started
if is_service_enabled n-api; then
if is_service_enabled n-cpu; then
create_cell
$TOP_DIR/tools/discover_hosts.sh
else
# Some CI systems like Hyper-V build the control plane on
# Linux, and join in non Linux Computes after setup. This