From bfa6540457fa50ca1f49e71bf495655bc2794b99 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 16 Jan 2024 10:53:16 +0900 Subject: [PATCH] rbd: Support options for deferred deletion This introduces support for the options used by the deferred deletion feature[1]. [1] c6580b2ab4ba10fefddf790a9282d1201df782f1 Change-Id: Ia385f88f1a9cdf79ca912844ff773fbc3e3fd688 --- manifests/backend/rbd.pp | 21 +++++++++++++++++++ ...bd-deferred-deletion-17e67e13aa2d062b.yaml | 5 +++++ spec/defines/cinder_backend_rbd_spec.rb | 9 ++++++++ 3 files changed, 35 insertions(+) create mode 100644 releasenotes/notes/rbd-deferred-deletion-17e67e13aa2d062b.yaml diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 80bf7974..1b5d7d39 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -76,6 +76,21 @@ # (optional) Set to True if the pool is used exclusively by Cinder. # Defaults to $facts['os_service_default'] # +# [*enable_deferred_deletion*] +# (optional) Enable deferred deletion. Upon deletion, volumes are tagged for +# deletion but will only be removed asynchronously at a later time. +# Defaults to $facts['os_service_default'] +# +# [*deferred_deletion_delay*] +# (optional) Time delay in seconds before a volume is eligible for permanent +# removal after being tagged for deferred deletion. +# Defaults to $facts['os_service_default'] +# +# [*deferred_deletion_purge_interval*] +# (optional) Number of seconds between runs of the periodic task to purge +# volumes tagged for deletion. +# Defaults to $facts['os_service_default'] +# # [*manage_volume_type*] # (Optional) Whether or not manage Cinder Volume type. # If set to true, a Cinder Volume type will be created @@ -105,6 +120,9 @@ define cinder::backend::rbd ( $rbd_store_chunk_size = $facts['os_service_default'], $report_dynamic_total_capacity = $facts['os_service_default'], $rbd_exclusive_cinder_pool = $facts['os_service_default'], + $enable_deferred_deletion = $facts['os_service_default'], + $deferred_deletion_delay = $facts['os_service_default'], + $deferred_deletion_purge_interval = $facts['os_service_default'], Boolean $manage_volume_type = false, Hash $extra_options = {}, ) { @@ -138,6 +156,9 @@ define cinder::backend::rbd ( "${name}/rbd_cluster_name": value => $rbd_cluster_name_real; "${name}/report_dynamic_total_capacity": value => $report_dynamic_total_capacity; "${name}/rbd_exclusive_cinder_pool": value => $rbd_exclusive_cinder_pool; + "${name}/enable_deferred_deletion": value => $enable_deferred_deletion; + "${name}/deferred_deletion_delay": value => $deferred_deletion_delay; + "${name}/deferred_deletion_purge_interval": value => $deferred_deletion_purge_interval; "${name}/report_discard_supported": value => true; } diff --git a/releasenotes/notes/rbd-deferred-deletion-17e67e13aa2d062b.yaml b/releasenotes/notes/rbd-deferred-deletion-17e67e13aa2d062b.yaml new file mode 100644 index 00000000..40319ff6 --- /dev/null +++ b/releasenotes/notes/rbd-deferred-deletion-17e67e13aa2d062b.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``cinder::backends::rbd`` defined resource type now supports options + used by the deferred deletion feature. diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index 053cb4b3..dd350de3 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -38,6 +38,9 @@ describe 'cinder::backend::rbd' do is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_store_chunk_size").with_value('') is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/report_dynamic_total_capacity").with_value('') is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_exclusive_cinder_pool").with_value('') + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/enable_deferred_deletion").with_value('') + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_delay").with_value('') + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_purge_interval").with_value('') is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/report_discard_supported").with_value(true) } @@ -57,6 +60,9 @@ describe 'cinder::backend::rbd' do :rbd_store_chunk_size => 4, :report_dynamic_total_capacity => true, :rbd_exclusive_cinder_pool => false, + :enable_deferred_deletion => false, + :deferred_deletion_delay => 0, + :deferred_deletion_purge_interval => 60, }) end @@ -79,6 +85,9 @@ describe 'cinder::backend::rbd' do is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_store_chunk_size").with_value(params[:rbd_store_chunk_size]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/report_dynamic_total_capacity").with_value(params[:report_dynamic_total_capacity]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_exclusive_cinder_pool").with_value(params[:rbd_exclusive_cinder_pool]) + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/enable_deferred_deletion").with_value(params[:enable_deferred_deletion]) + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_delay").with_value(params[:deferred_deletion_delay]) + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_purge_interval").with_value(params[:deferred_deletion_purge_interval]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/report_discard_supported").with_value(true) } end