Merge "Run Glance initialization when Glance is enabled, not just registry (v2)"
diff --git a/lib/glance b/lib/glance
index b4cab2a..740bcab 100644
--- a/lib/glance
+++ b/lib/glance
@@ -276,18 +276,16 @@
     rm -rf $GLANCE_IMAGE_DIR
     mkdir -p $GLANCE_IMAGE_DIR
 
-    if is_service_enabled $DATABASE_BACKENDS; then
-        # (Re)create glance database
-        recreate_database glance
+    # (Re)create glance database
+    recreate_database glance
 
-        time_start "dbsync"
-        # Migrate glance database
-        $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync
+    time_start "dbsync"
+    # Migrate glance database
+    $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync
 
-        # Load metadata definitions
-        $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs
-        time_stop "dbsync"
-    fi
+    # Load metadata definitions
+    $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs
+    time_stop "dbsync"
 }
 
 # install_glanceclient() - Collect source and prepare
diff --git a/stack.sh b/stack.sh
index 089510f..fe71eae 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1155,7 +1155,8 @@
 # Glance
 # ------
 
-if is_service_enabled g-reg; then
+# NOTE(yoctozepto): limited to node hosting the database which is the controller
+if is_service_enabled $DATABASE_BACKENDS && is_service_enabled glance; then
     echo_summary "Configuring Glance"
     init_glance
 fi
@@ -1280,8 +1281,8 @@
 # scripts as userdata.
 # See https://help.ubuntu.com/community/CloudInit for more on ``cloud-init``
 
-if is_service_enabled g-reg; then
-
+# NOTE(yoctozepto): limited to node hosting the database which is the controller
+if is_service_enabled $DATABASE_BACKENDS && is_service_enabled glance; then
     echo_summary "Uploading images"
 
     for image_url in ${IMAGE_URLS//,/ }; do