Set rbd_cluster_name to cope with custom cluster names

Cinder requires the Ceph cluster name to be set explicitly in
rbd_cluster_name when not 'ceph'.

Change-Id: I880184255a1f7c39ae66bd8ad7c361d65d378a0c
Closes-Bug: 1796096
(cherry picked from commit 612279161b)
This commit is contained in:
Giulio Fidente 2018-10-04 16:13:02 +02:00
parent 22ee15c194
commit 7a15cb9307
2 changed files with 11 additions and 0 deletions

View File

@ -98,6 +98,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}/volume_driver": value => 'cinder.volume.drivers.rbd.RBDDriver';
@ -111,6 +119,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

@ -62,6 +62,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'
}"
@ -70,6 +71,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