From c3b96f88e8339f51582323e27bbd5bb202d54da8 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Fri, 7 Dec 2018 10:19:15 -0500 Subject: [PATCH] RBD: Report discard is supported The RBD driver has supported discard (trim/unmap) since [1]. This patch makes the driver advertise that it does so. Based on how the setting is implemented, it is safe to hard code the value: "Report to clients of Cinder that the backend supports discard (aka. trim/unmap). This will not actually change the behavior of the backend or the client directly, it will only notify that it can be used." [1] I094163b99d858384584966d65e9d8756c74a0c15 Change-Id: I2f1a4214c3a0561e6df99e8234a9b98f14139264 --- manifests/backend/rbd.pp | 1 + spec/defines/cinder_backend_rbd_spec.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 19d1a77e..dc40c24f 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -119,6 +119,7 @@ define cinder::backend::rbd ( "${name}/rados_connection_retries": value => $rados_connection_retries; "${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size; "${name}/rbd_cluster_name": value => $rbd_cluster_name_real; + "${name}/report_discard_supported": value => true; } if $manage_volume_type { diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index 09eff902..7c4e0094 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -42,6 +42,7 @@ describe 'cinder::backend::rbd' do should contain_cinder_config("#{req_params[:volume_backend_name]}/rados_connection_interval").with_value(req_params[:rados_connection_interval]) should contain_cinder_config("#{req_params[:volume_backend_name]}/rados_connection_retries").with_value(req_params[:rados_connection_retries]) should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_store_chunk_size").with_value(req_params[:rbd_store_chunk_size]) + should contain_cinder_config("#{req_params[:volume_backend_name]}/report_discard_supported").with_value(true) } context 'with another RBD backend' do @@ -60,6 +61,7 @@ describe 'cinder::backend::rbd' do it { should contain_cinder_config("ceph2/rbd_cluster_name").with_value('ceph2') } it { should contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') } it { should contain_cinder_config("ceph2/rbd_user").with_value('test2') } + it { should contain_cinder_config("ceph2/report_discard_supported").with_value(true) } end context 'rbd backend with additional configuration' do