Browse code

Run Glance initialization when Glance is enabled, not just registry (v2)

Per [1] Glance registry should not be required to run since Queens.

v2 improves on v1 [2] (now reverted [3]) by applying minor comments
from reviews so far and ensuring nova-live-migration job does not see
a change in behavior and hence does not break [4].
[5] tried to fix the issue but it did only partially, regarding
the database but not the image upload [6].
This patch ensures double cirros image upload does not happen as well.

[1] https://specs.openstack.org/openstack/glance-specs/specs/queens/approved/glance/deprecate-registry.html
[2] https://review.opendev.org/702707
[3] https://review.opendev.org/703131
[4] https://bugs.launchpad.net/devstack/+bug/1860021
[5] https://review.opendev.org/702960
[6] https://bugs.launchpad.net/devstack/+bug/1860021/comments/16

Change-Id: I61538acd6bd4c7b3da26c4084225b220d7d1aa2c
Closes-bug: #1859847
Related-bug: #1860021

Radosław Piliszek authored on 2020/01/19 20:41:14
Showing 2 changed files
... ...
@@ -276,18 +276,16 @@ function init_glance {
276 276
     rm -rf $GLANCE_IMAGE_DIR
277 277
     mkdir -p $GLANCE_IMAGE_DIR
278 278
 
279
-    if is_service_enabled $DATABASE_BACKENDS; then
280
-        # (Re)create glance database
281
-        recreate_database glance
279
+    # (Re)create glance database
280
+    recreate_database glance
282 281
 
283
-        time_start "dbsync"
284
-        # Migrate glance database
285
-        $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync
282
+    time_start "dbsync"
283
+    # Migrate glance database
284
+    $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync
286 285
 
287
-        # Load metadata definitions
288
-        $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs
289
-        time_stop "dbsync"
290
-    fi
286
+    # Load metadata definitions
287
+    $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs
288
+    time_stop "dbsync"
291 289
 }
292 290
 
293 291
 # install_glanceclient() - Collect source and prepare
... ...
@@ -1155,7 +1155,8 @@ fi
1155 1155
 # Glance
1156 1156
 # ------
1157 1157
 
1158
-if is_service_enabled g-reg; then
1158
+# NOTE(yoctozepto): limited to node hosting the database which is the controller
1159
+if is_service_enabled $DATABASE_BACKENDS && is_service_enabled glance; then
1159 1160
     echo_summary "Configuring Glance"
1160 1161
     init_glance
1161 1162
 fi
... ...
@@ -1280,8 +1281,8 @@ fi
1280 1280
 # scripts as userdata.
1281 1281
 # See https://help.ubuntu.com/community/CloudInit for more on ``cloud-init``
1282 1282
 
1283
-if is_service_enabled g-reg; then
1284
-
1283
+# NOTE(yoctozepto): limited to node hosting the database which is the controller
1284
+if is_service_enabled $DATABASE_BACKENDS && is_service_enabled glance; then
1285 1285
     echo_summary "Uploading images"
1286 1286
 
1287 1287
     for image_url in ${IMAGE_URLS//,/ }; do