Browse code

Init placement before nova

With change I7e1e89cd66397883453935dcf7172d977bf82e84 the placement
service may optionally use its own database. In order for this to
work, however, the ordering of how both nova and placement are
configured and initialized in stack.sh requires careful control.

* nova.conf must be created first
* then placement must make some adjustments to it
* then lib/placement needs to create the placement database
* before nova does a database sync (of both databases)

Otherwise, when the placement_database/connection is defined, the nova
db_sync command will fail because the placement database does not yet
exist. If we try to do a sync before the nova_api database is created
_that_ sync will fail.

This patch adjusts the ordering and also removes a comment that will
no longer be true when I7e1e89cd66397883453935dcf7172d977bf82e84 is
merged.

Change-Id: Id5b5911c04d198fe7b94c7d827afeb5cdf43a076

Chris Dent authored on 2018/04/25 21:01:03
Showing 2 changed files
... ...
@@ -44,8 +44,6 @@ PLACEMENT_UWSGI_CONF=$PLACEMENT_CONF_DIR/placement-uwsgi.ini
44 44
 
45 45
 # The placement service can optionally use a separate database
46 46
 # connection. Set PLACEMENT_DB_ENABLED to True to use it.
47
-# NOTE(cdent): This functionality depends on some code that is not
48
-# yet merged in nova but is coming soon.
49 47
 PLACEMENT_DB_ENABLED=$(trueorfalse False PLACEMENT_DB_ENABLED)
50 48
 
51 49
 if is_service_enabled tls-proxy; then
... ...
@@ -152,9 +150,9 @@ function create_placement_accounts {
152 152
 function init_placement {
153 153
     if [ "$PLACEMENT_DB_ENABLED" != False ]; then
154 154
         recreate_database placement
155
-        time_start "dbsync"
156
-        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
157
-        time_stop "dbsync"
155
+        # Database migration will be handled when nova does an api_db sync
156
+        # TODO(cdent): When placement is extracted we'll do our own sync
157
+        # here.
158 158
     fi
159 159
     create_placement_accounts
160 160
 }
... ...
@@ -894,6 +894,8 @@ if is_service_enabled neutron; then
894 894
     stack_install_service neutron
895 895
 fi
896 896
 
897
+# Nova configuration is used by placement so we need to create nova.conf
898
+# first.
897 899
 if is_service_enabled nova; then
898 900
     # Compute service
899 901
     stack_install_service nova
... ...
@@ -1184,6 +1186,13 @@ if is_service_enabled cinder; then
1184 1184
     init_cinder
1185 1185
 fi
1186 1186
 
1187
+# Placement Service
1188
+# ---------------
1189
+
1190
+if is_service_enabled placement; then
1191
+    echo_summary "Configuring placement"
1192
+    init_placement
1193
+fi
1187 1194
 
1188 1195
 # Compute Service
1189 1196
 # ---------------
... ...
@@ -1202,11 +1211,6 @@ if is_service_enabled nova; then
1202 1202
     init_nova_cells
1203 1203
 fi
1204 1204
 
1205
-if is_service_enabled placement; then
1206
-    echo_summary "Configuring placement"
1207
-    init_placement
1208
-fi
1209
-
1210 1205
 
1211 1206
 # Extras Configuration
1212 1207
 # ====================