Cinder: Support backup driver specification by module or class name

During the Queens cycle, Cinder introduced the ability to specify the
backup driver via class name and deprecated backup driver initialization
using the module name. (Id6bee9e7d0da8ead224a04f86fe79ddfb5b286cf)

Legacy support for initialization by module name was dropped in Stein.
(I3ada2dee1857074746b1893b82dd5f6641c6e579)

This change will support both methods of initialization and leave the
driver defaults enabled for module based initialization (valid through
Rocky images).

This change has been tested using the OSH default Cinder (Ocata) images
and StarlingX images based on master (Train).

Change-Id: Iec7bc6f4dd089aaa08ca652bebd9a10ef49da556
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2019-05-24 02:43:15 -04:00
parent 89f5bfe3ac
commit aa4ca5ad56
7 changed files with 24 additions and 20 deletions

View File

@ -17,7 +17,7 @@ limitations under the License.
*/}} */}}
set -x set -x
if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then
SECRET=$(mktemp --suffix .yaml) SECRET=$(mktemp --suffix .yaml)
KEYRING=$(mktemp --suffix .keyring) KEYRING=$(mktemp --suffix .keyring)
function cleanup { function cleanup {
@ -27,10 +27,10 @@ if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then
fi fi
set -ex set -ex
if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.swift" ] || \ if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.swift' ]] || \
[ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.posix" ]; then [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.posix' ]]; then
echo "INFO: no action required to use $STORAGE_BACKEND" echo "INFO: no action required to use $STORAGE_BACKEND"
elif [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then elif [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then
ceph -s ceph -s
function ensure_pool () { function ensure_pool () {
ceph osd pool stats $1 || ceph osd pool create $1 $2 ceph osd pool stats $1 || ceph osd pool create $1 $2

View File

@ -63,7 +63,7 @@ limitations under the License.
{{- $_ := tuple "image" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.DEFAULT "glance_api_servers" -}} {{- $_ := tuple "image" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.DEFAULT "glance_api_servers" -}}
{{- end -}} {{- end -}}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.swift" }} {{- if (contains "cinder.backup.drivers.swift" .Values.conf.cinder.DEFAULT.backup_driver) }}
{{- if empty .Values.conf.cinder.DEFAULT.backup_swift_auth_version -}} {{- if empty .Values.conf.cinder.DEFAULT.backup_swift_auth_version -}}
{{- $_ := set .Values.conf.cinder.DEFAULT "backup_swift_auth_version" "3" -}} {{- $_ := set .Values.conf.cinder.DEFAULT "backup_swift_auth_version" "3" -}}
{{- end -}} {{- end -}}

View File

@ -54,7 +54,7 @@ spec:
{{ .Values.labels.backup.node_selector_key }}: {{ .Values.labels.backup.node_selector_value }} {{ .Values.labels.backup.node_selector_key }}: {{ .Values.labels.backup.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll "backup" $mounts_cinder_backup_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "backup" $mounts_cinder_backup_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-backup-keyring-placement - name: ceph-backup-keyring-placement
{{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@ -102,7 +102,7 @@ spec:
subPath: key subPath: key
readOnly: true readOnly: true
{{ end }} {{ end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-backup-volume-perms - name: ceph-backup-volume-perms
{{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@ -162,7 +162,7 @@ spec:
subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }} subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }}
readOnly: true readOnly: true
{{- end }} {{- end }}
{{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
{{- if not .Values.backup.external_ceph_rbd.enabled }} {{- if not .Values.backup.external_ceph_rbd.enabled }}
@ -176,7 +176,7 @@ spec:
subPath: external-backup-ceph.conf subPath: external-backup-ceph.conf
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-backup-keyring - name: ceph-backup-keyring
mountPath: /tmp/client-keyring mountPath: /tmp/client-keyring
subPath: key subPath: key
@ -188,7 +188,7 @@ spec:
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: cinder-backup - name: cinder-backup
mountPath: {{ .Values.conf.cinder.DEFAULT.backup_posix_path }} mountPath: {{ .Values.conf.cinder.DEFAULT.backup_posix_path }}
{{- end }} {{- end }}
@ -227,7 +227,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc
@ -235,7 +235,7 @@ spec:
name: {{ .Values.ceph_client.configmap }} name: {{ .Values.ceph_client.configmap }}
defaultMode: 0444 defaultMode: 0444
{{ end }} {{ end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-backup-keyring - name: ceph-backup-keyring
secret: secret:
secretName: {{ .Values.secrets.rbd.backup | quote }} secretName: {{ .Values.secrets.rbd.backup | quote }}
@ -245,7 +245,7 @@ spec:
secret: secret:
secretName: {{ .Values.secrets.rbd.volume | quote }} secretName: {{ .Values.secrets.rbd.volume | quote }}
{{ end }} {{ end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: cinder-backup - name: cinder-backup
persistentVolumeClaim: persistentVolumeClaim:
claimName: cinder-backup claimName: cinder-backup

View File

@ -67,7 +67,7 @@ spec:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll "backup_storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "backup_storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-keyring-placement - name: ceph-keyring-placement
{{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@ -108,7 +108,7 @@ spec:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: STORAGE_BACKEND - name: STORAGE_BACKEND
value: {{ .Values.conf.cinder.DEFAULT.backup_driver | quote }} value: {{ .Values.conf.cinder.DEFAULT.backup_driver | quote }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: RBD_POOL_NAME - name: RBD_POOL_NAME
value: {{ .Values.conf.cinder.DEFAULT.backup_ceph_pool | quote }} value: {{ .Values.conf.cinder.DEFAULT.backup_ceph_pool | quote }}
- name: RBD_POOL_APP_NAME - name: RBD_POOL_APP_NAME
@ -133,7 +133,7 @@ spec:
mountPath: /tmp/backup-storage-init.sh mountPath: /tmp/backup-storage-init.sh
subPath: backup-storage-init.sh subPath: backup-storage-init.sh
readOnly: true readOnly: true
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
{{- if not .Values.backup.external_ceph_rbd.enabled }} {{- if not .Values.backup.external_ceph_rbd.enabled }}
@ -161,7 +161,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@ -16,7 +16,7 @@ limitations under the License.
{{- if .Values.manifests.job_clean }} {{- if .Values.manifests.job_clean }}
{{- $envAll := . }} {{- $envAll := . }}
{{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }}
{{- $serviceAccountName := print "cinder-clean" }} {{- $serviceAccountName := print "cinder-clean" }}
{{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
@ -89,7 +89,7 @@ spec:
subPath: clean-secrets.sh subPath: clean-secrets.sh
readOnly: true readOnly: true
{{ end }} {{ end }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: cinder-volume-backup-secret-clean - name: cinder-volume-backup-secret-clean
{{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}

View File

@ -16,7 +16,7 @@ limitations under the License.
{{- if .Values.manifests.pvc_backup }} {{- if .Values.manifests.pvc_backup }}
{{- $envAll := . }} {{- $envAll := . }}
{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }}
--- ---
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
apiVersion: v1 apiVersion: v1

View File

@ -793,6 +793,10 @@ conf:
default_volume_type: "rbd1" default_volume_type: "rbd1"
# NOTE(portdirect): "cinder.backup.drivers.ceph" and # NOTE(portdirect): "cinder.backup.drivers.ceph" and
# "cinder.backup.drivers.posix" also supported # "cinder.backup.drivers.posix" also supported
# NOTE(rchurch): As of Stein, drivers by class name are required
# - cinder.backup.drivers.swift.SwiftBackupDriver
# - cinder.backup.drivers.ceph.CephBackupDriver
# - cinder.backup.drivers.posix.PosixBackupDriver
backup_driver: "cinder.backup.drivers.swift" backup_driver: "cinder.backup.drivers.swift"
# Backup: Ceph RBD options # Backup: Ceph RBD options
backup_ceph_conf: "/etc/ceph/ceph.conf" backup_ceph_conf: "/etc/ceph/ceph.conf"