Make Glance storage-init flexible per enabled storage backends

This update enhances the Glance storage-init script to properly handle
multiple storage backends.
Backends such as file, cinder, and pvc—commonly used for NetApp
NFS/iSCSI bypass Ceph initialization and emit an informational
message.

The existing Ceph (rbd) bootstrap logic remains unchanged and is
executed only when rbd is the selected backend, ensuring correct
behavior in both single-backend and mixed-backend deployments.

TEST PLAN:
All tests were run on the following environment:
Virtual Environment with AIO-SX + NetApp simulator
PASS - build-pkgs -a -l openstack
PASS - build stx-openstack tarball
PASS - application upload, apply and remove
PASS - apply on Ceph only: ceph bootstrapped, netapp logic skipped and
       an openstack image must be created
PASS - apply on NetApp only: ceph logic skipped, show netapp message
       and an openstack image must be created
PASS - apply on Ceph and NetApp: ceph bootstrapped, show netapp message
       and an openstack image must be created

Story: 2011281
Task: 53510

Change-Id: Icc9387dd24d292fb96d8973de90011991a3c5bda
Signed-off-by: Thiago Miranda <tmarques@windriver.com>
This commit is contained in:
Thiago Miranda
2025-11-24 10:14:32 -03:00
parent 27ed8cf93f
commit e95311b336
2 changed files with 63 additions and 0 deletions
@@ -0,0 +1,62 @@
From 5d77d05f29b7589c801c8980aa438854dbb3b7ec Mon Sep 17 00:00:00 2001
From: Thiago Miranda <tmarques@windriver.com>
Date: Mon, 24 Nov 2025 09:45:21 -0300
Subject: [PATCH] Add backend checks to skip Ceph init for NetApp storage
Introduce conditional logic to skip Ceph initialization when using
NetApp backends (file, cinder, or pvc).
The script now prints an informational message and only runs the Ceph
bootstrap when the backend is rbd.
Signed-off-by: Thiago Miranda <tmarques@windriver.com>
---
glance/templates/bin/_storage-init.sh.tpl | 10 +++++++---
glance/templates/job-storage-init.yaml | 4 ++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/glance/templates/bin/_storage-init.sh.tpl b/glance/templates/bin/_storage-init.sh.tpl
index f780ff9e8..0df7cee8d 100644
--- a/glance/templates/bin/_storage-init.sh.tpl
+++ b/glance/templates/bin/_storage-init.sh.tpl
@@ -30,8 +30,12 @@ if [[ "$SCHEME" == "https" && -f /etc/ssl/certs/openstack-helm.crt ]]; then
fi
set -ex
-if [ "x$STORAGE_BACKEND" == "xpvc" ]; then
- echo "No action required."
+if [ "x$STORAGE_BACKEND" == "xfile" ] || [ "x$STORAGE_BACKEND" == "xcinder" ] || [ "x$STORAGE_BACKEND" == "xpvc" ]; then
+ if [ "x$STORAGE_BACKEND_CEPH_ENABLED" == "xtrue" ]; then
+ echo "WARN: Ceph is enabled. Skipping $STORAGE_BACKEND backend configuration."
+ else
+ echo "INFO: No action required to use $STORAGE_BACKEND backend."
+ fi
elif [ "x$STORAGE_BACKEND" == "xswift" ]; then
: ${OS_INTERFACE:="internal"}
OS_TOKEN="$(openstack token issue -f value -c id)"
@@ -41,7 +45,7 @@ elif [ "x$STORAGE_BACKEND" == "xswift" ]; then
curl --fail -i -X POST "${OS_SWIFT_SCOPED_ENDPOINT}" \
-H "X-Auth-Token: ${OS_TOKEN}" \
-H "X-Account-Meta-Temp-URL-Key: ${SWIFT_TMPURL_KEY}"
-elif [ "x$STORAGE_BACKEND" == "xrbd" ]; then
+elif [ "x$STORAGE_BACKEND" == "xrbd" ] && [ "x$STORAGE_BACKEND_CEPH_ENABLED" == "xtrue" ]; then
ceph -s
function ensure_pool () {
if [ "$2" -eq 0 ]; then
diff --git a/glance/templates/job-storage-init.yaml b/glance/templates/job-storage-init.yaml
index 22cd41098..8e35ace31 100644
--- a/glance/templates/job-storage-init.yaml
+++ b/glance/templates/job-storage-init.yaml
@@ -112,6 +112,10 @@ spec:
fieldPath: metadata.namespace
- name: STORAGE_BACKEND
value: {{ .Values.storage | quote }}
+ {{- range .Values.storage_conf.storage_backends }}
+ - name: "STORAGE_BACKEND_{{ .name | upper }}_ENABLED"
+ value: "{{ .enabled | toString }}"
+ {{- end }}
{{- if eq .Values.storage "rbd" }}
- name: RBD_POOL_NAME
value: {{ .Values.conf.glance.glance_store.rbd_store_pool | quote }}
--
2.34.1
@@ -29,3 +29,4 @@
0029-Add-DEX-integration.patch
0030-Add-Netapp-backend-support-to-Cinder.patch
0031-Update-glance-store-config.patch
0032-Add-backend-checks-to-skip-Ceph-init-for-NetApp-stor.patch