diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 089c5eac..19d1a77e 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -96,6 +96,14 @@ define cinder::backend::rbd ( include ::cinder::deps include ::cinder::params + $rbd_cluster_name = basename($rbd_ceph_conf, '.conf') + if $rbd_cluster_name == 'ceph' { + # Do not pass a parameter value in order to avoid service restarts + $rbd_cluster_name_real = undef + } else { + $rbd_cluster_name_real = $rbd_cluster_name + } + cinder_config { "${name}/volume_backend_name": value => $volume_backend_name; "${name}/backend_availability_zone": value => $backend_availability_zone; @@ -110,6 +118,7 @@ define cinder::backend::rbd ( "${name}/rados_connection_interval": value => $rados_connection_interval; "${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; } if $manage_volume_type { diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index 95911d4e..9149b060 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -63,6 +63,7 @@ describe 'cinder::backend::rbd' do context 'with another RBD backend' do let :pre_condition do "cinder::backend::rbd { 'ceph2': + rbd_ceph_conf => '/foo/boo/zoo/ceph2.conf', rbd_pool => 'volumes2', rbd_user => 'test2' }" @@ -71,6 +72,7 @@ describe 'cinder::backend::rbd' do it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) } it { is_expected.to contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') } + it { is_expected.to contain_cinder_config("ceph2/rbd_cluster_name").with_value('ceph2') } it { is_expected.to contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') } it { is_expected.to contain_cinder_config("ceph2/rbd_user").with_value('test2') } end