Browse code

lib/nova: create api db first

Since I21ae13a6c029e8ac89484faa212434911160fd51 nova-manage db sync
may try to make a request to api db in order to get cell mapping and
will fail, as the db is not created yet. While this is non fatal, we
could avoid the error anyway.

Change-Id: I19483e9420071d484f029779bcc8c6d623c210ce
Related-Bug: #1631033

Roman Podoliaka authored on 2016/10/11 19:15:55
Showing 1 changed files
... ...
@@ -676,6 +676,9 @@ function init_nova {
676 676
     # All nova components talk to a central database.
677 677
     # Only do this step once on the API node for an entire cluster.
678 678
     if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then
679
+        recreate_database $NOVA_API_DB
680
+        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
681
+
679 682
         # (Re)create nova databases
680 683
         recreate_database nova
681 684
         recreate_database nova_api_cell0
... ...
@@ -689,9 +692,6 @@ function init_nova {
689 689
             recreate_database $NOVA_CELLS_DB
690 690
         fi
691 691
 
692
-        recreate_database $NOVA_API_DB
693
-        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
694
-
695 692
         # Run online migrations on the new databases
696 693
         # Needed for flavor conversion
697 694
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations