diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index 3c7363c9b..af7eaeab1 100644 --- a/ceph-client/Chart.yaml +++ b/ceph-client/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Client name: ceph-client -version: 0.1.16 +version: 0.1.17 home: https://github.com/ceph/ceph-client ... diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index ec81a96c0..0e68adab4 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -325,13 +325,27 @@ fi {{- range $pool := .Values.conf.pool.spec -}} {{- with $pool }} +pool_name="{{ .name }}" +{{- if .rename }} +# If a renamed pool exists, that name should be used for idempotence +if [[ -n "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .rename }}$)" ]]; then + pool_name="{{ .rename }}" +fi +{{- end }} # Read the pool quota from the pool spec (no quota if absent) # Set pool_quota to 0 if target_quota is 0 [[ ${target_quota} -eq 0 ]] && pool_quota=0 || pool_quota="$(convert_to_bytes {{ .pool_quota | default 0 }})" {{- if .crush_rule }} -manage_pool {{ .application }} {{ .name }} {{ .replication }} {{ .percent_total_data }} {{ $targetPGperOSD }} {{ .crush_rule }} $pool_quota {{ $targetProtection }} ${cluster_capacity} +manage_pool {{ .application }} ${pool_name} {{ .replication }} {{ .percent_total_data }} {{ $targetPGperOSD }} {{ .crush_rule }} $pool_quota {{ $targetProtection }} ${cluster_capacity} {{ else }} -manage_pool {{ .application }} {{ .name }} {{ .replication }} {{ .percent_total_data }} {{ $targetPGperOSD }} {{ $crushRuleDefault }} $pool_quota {{ $targetProtection }} ${cluster_capacity} +manage_pool {{ .application }} ${pool_name} {{ .replication }} {{ .percent_total_data }} {{ $targetPGperOSD }} {{ $crushRuleDefault }} $pool_quota {{ $targetProtection }} ${cluster_capacity} +{{- end }} +{{- if .rename }} +# If a rename value exists, the pool exists, and a pool with the rename value doesn't exist, rename the pool +if [[ -n "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .name }}$)" ]] && + [[ -z "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .rename }}$)" ]]; then + ceph --cluster "${CLUSTER}" osd pool rename "{{ .name }}" "{{ .rename }}" +fi {{- end }} {{- end }} {{- end }} diff --git a/ceph-client/values.yaml b/ceph-client/values.yaml index dcb49b3fe..08987fd37 100644 --- a/ceph-client/values.yaml +++ b/ceph-client/values.yaml @@ -348,6 +348,12 @@ conf: percent_total_data: 5 # RBD pool - name: rbd + # An optional "rename" value may be used to change the name of an existing pool. + # If the pool doesn't exist, it will be created and renamed. If the pool exists with + # the original name, it will be renamed. If the pool exists and has already been + # renamed, the name will not be changed. If two pools exist with the two names, the + # pool matching the renamed value will be configured and the other left alone. + # rename: rbd-new application: rbd replication: 3 percent_total_data: 40 diff --git a/releasenotes/notes/ceph-client.yaml b/releasenotes/notes/ceph-client.yaml index fb36e57f5..c7b0a3af5 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -17,4 +17,5 @@ ceph-client: - 0.1.14 Allow Ceph RBD pool job to leave failed pods - 0.1.15 Make ceph-client helm test more PG specific - 0.1.16 Make Ceph pool init job consistent with helm test + - 0.1.17 Add pool rename support for Ceph pools ...