[ceph-client] Add pool rename support for Ceph pools
A new value "rename" has been added to the Ceph pool spec to allow pools to be renamed in a brownfield deployment. For greenfield the pool will be created and renamed in a single deployment step, and for a brownfield deployment in which the pool has already been renamed previously no changes will be made to pool names. Change-Id: I3fba88d2f94e1c7102af91f18343346a72872fde
This commit is contained in:
parent
d4f253ef9f
commit
9f3b9f4f56
@ -15,6 +15,6 @@ apiVersion: v1
|
|||||||
appVersion: v1.0.0
|
appVersion: v1.0.0
|
||||||
description: OpenStack-Helm Ceph Client
|
description: OpenStack-Helm Ceph Client
|
||||||
name: ceph-client
|
name: ceph-client
|
||||||
version: 0.1.16
|
version: 0.1.17
|
||||||
home: https://github.com/ceph/ceph-client
|
home: https://github.com/ceph/ceph-client
|
||||||
...
|
...
|
||||||
|
@ -325,13 +325,27 @@ fi
|
|||||||
|
|
||||||
{{- range $pool := .Values.conf.pool.spec -}}
|
{{- range $pool := .Values.conf.pool.spec -}}
|
||||||
{{- with $pool }}
|
{{- 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)
|
# Read the pool quota from the pool spec (no quota if absent)
|
||||||
# Set pool_quota to 0 if target_quota is 0
|
# 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 }})"
|
[[ ${target_quota} -eq 0 ]] && pool_quota=0 || pool_quota="$(convert_to_bytes {{ .pool_quota | default 0 }})"
|
||||||
{{- if .crush_rule }}
|
{{- 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 }}
|
{{ 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 }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -348,6 +348,12 @@ conf:
|
|||||||
percent_total_data: 5
|
percent_total_data: 5
|
||||||
# RBD pool
|
# RBD pool
|
||||||
- name: rbd
|
- 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
|
application: rbd
|
||||||
replication: 3
|
replication: 3
|
||||||
percent_total_data: 40
|
percent_total_data: 40
|
||||||
|
@ -17,4 +17,5 @@ ceph-client:
|
|||||||
- 0.1.14 Allow Ceph RBD pool job to leave failed pods
|
- 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.15 Make ceph-client helm test more PG specific
|
||||||
- 0.1.16 Make Ceph pool init job consistent with helm test
|
- 0.1.16 Make Ceph pool init job consistent with helm test
|
||||||
|
- 0.1.17 Add pool rename support for Ceph pools
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user