Merge "Make Glance storage-init flexible per enabled storage backends"

This commit is contained in:
Zuul
2025-12-19 14:53:04 +00:00
committed by Gerrit Code Review
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