Browse code

Create cell1 cell before n-api starts

Change ac5fdb4c4090efd682cc5c55aa30ec433da29fc7 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

Matt Riedemann authored on 2017/03/03 02:45:47
Showing 2 changed files
... ...
@@ -664,6 +664,10 @@ function init_nova_cells {
664 664
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync
665 665
         $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
666 666
         $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
667
+
668
+        # Creates the single cells v2 cell for the child cell (v1) nova db.
669
+        nova-manage --config-file $NOVA_CELLS_CONF cell_v2 create_cell \
670
+            --transport-url $(get_transport_url child_cell) --name 'cell1'
667 671
     fi
668 672
 }
669 673
 
... ...
@@ -720,6 +724,10 @@ function init_nova {
720 720
         # Run online migrations on the new databases
721 721
         # Needed for flavor conversion
722 722
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations
723
+
724
+        # create the cell1 cell for the main nova db where the hosts live
725
+        nova-manage cell_v2 create_cell --transport-url $(get_transport_url) \
726
+            --name 'cell1'
723 727
     fi
724 728
 
725 729
     create_nova_cache_dir
... ...
@@ -968,17 +976,6 @@ function create_flavors {
968 968
     fi
969 969
 }
970 970
 
971
-# create_cell(): Group the available hosts into a cell
972
-function create_cell {
973
-    if ! is_service_enabled n-cell; then
974
-        nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
975
-    else
976
-        nova-manage --config-file $NOVA_CELLS_CONF  --verbose cell_v2 map_cell_and_hosts \
977
-                --transport-url $(get_transport_url child_cell) --name 'cell1'
978
-        nova-manage db sync
979
-    fi
980
-}
981
-
982 971
 # Restore xtrace
983 972
 $_XTRACE_LIB_NOVA
984 973
 
... ...
@@ -1364,7 +1364,7 @@ check_libs_from_git
1364 1364
 # Do this late because it requires compute hosts to have started
1365 1365
 if is_service_enabled n-api; then
1366 1366
     if is_service_enabled n-cpu; then
1367
-        create_cell
1367
+        $TOP_DIR/tools/discover_hosts.sh
1368 1368
     else
1369 1369
         # Some CI systems like Hyper-V build the control plane on
1370 1370
         # Linux, and join in non Linux Computes after setup. This