Merge "Set rbd_cluster_name to cope with custom cluster names"

This commit is contained in:
Zuul 2018-10-24 19:46:21 +00:00 committed by Gerrit Code Review
commit f0708f4ec5
2 changed files with 11 additions and 0 deletions

View File

@ -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 {

View File

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