Merge "[ceph-client] Add pool delete support for Ceph pools"

This commit is contained in:
Zuul 2021-05-25 14:22:57 +00:00 committed by Gerrit Code Review
commit 379ea64572
4 changed files with 20 additions and 1 deletions

View File

@ -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.17 version: 0.1.18
home: https://github.com/ceph/ceph-client home: https://github.com/ceph/ceph-client
... ...

View File

@ -345,6 +345,17 @@ manage_pool {{ .application }} ${pool_name} {{ .replication }} {{ .percent_total
if [[ -n "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .name }}$)" ]] && if [[ -n "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .name }}$)" ]] &&
[[ -z "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .rename }}$)" ]]; then [[ -z "$(ceph --cluster ${CLUSTER} osd pool ls | grep ^{{ .rename }}$)" ]]; then
ceph --cluster "${CLUSTER}" osd pool rename "{{ .name }}" "{{ .rename }}" ceph --cluster "${CLUSTER}" osd pool rename "{{ .name }}" "{{ .rename }}"
pool_name="{{ .rename }}"
fi
{{- end }}
{{- if and .delete .delete_all_pool_data }}
# If delete is set to true and delete_all_pool_data is also true, delete the pool
if [[ "true" == "{{ .delete }}" ]] &&
[[ "true" == "{{ .delete_all_pool_data }}" ]]; then
ceph --cluster "${CLUSTER}" tell mon.* injectargs '--mon-allow-pool-delete=true'
ceph --cluster "${CLUSTER}" osd pool set "${pool_name}" nodelete false
ceph --cluster "${CLUSTER}" osd pool delete "${pool_name}" "${pool_name}" --yes-i-really-really-mean-it
ceph --cluster "${CLUSTER}" tell mon.* injectargs '--mon-allow-pool-delete=false'
fi fi
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -354,6 +354,13 @@ conf:
# renamed, the name will not be changed. If two pools exist with the two names, the # 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. # pool matching the renamed value will be configured and the other left alone.
# rename: rbd-new # rename: rbd-new
# Optional "delete" and "delete_all_pool_data" values may be used to delete an
# existing pool. Both must exist and must be set to true in order to delete a pool.
# NOTE: Deleting a pool deletes all of its data and is unrecoverable. This is why
# both values are required in order to delete a pool. Neither value does
# anything by itself.
# delete: false
# delete_all_pool_data: false
application: rbd application: rbd
replication: 3 replication: 3
percent_total_data: 40 percent_total_data: 40

View File

@ -18,4 +18,5 @@ ceph-client:
- 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 - 0.1.17 Add pool rename support for Ceph pools
- 0.1.18 Add pool delete support for Ceph pools
... ...