rbd: Support options for deferred deletion

This introduces support for the options used by the deferred deletion
feature[1].

[1] c6580b2ab4ba10fefddf790a9282d1201df782f1

Change-Id: Ia385f88f1a9cdf79ca912844ff773fbc3e3fd688
This commit is contained in:
Takashi Kajinami 2024-01-16 10:53:16 +09:00
parent 0db5333328
commit bfa6540457
3 changed files with 35 additions and 0 deletions

View File

@ -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;
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``cinder::backends::rbd`` defined resource type now supports options
used by the deferred deletion feature.

View File

@ -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('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/report_dynamic_total_capacity").with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_exclusive_cinder_pool").with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/enable_deferred_deletion").with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_delay").with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/deferred_deletion_purge_interval").with_value('<SERVICE DEFAULT>')
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