RBD backend: use ensure_resource
In the case we want to declare more than one backend using RBD driver, we have a resource dupplication which could be fixed by using stlib functions. Closes-bug #1294138 Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com> Change-Id: I1783540cd8218e8bafb4d0b860ca4c5992f35a19
This commit is contained in:
@@ -98,14 +98,12 @@ define cinder::backend::rbd (
|
||||
}
|
||||
|
||||
# Creates an empty file if it doesn't yet exist
|
||||
file { $::cinder::params::ceph_init_override:
|
||||
ensure => present,
|
||||
}
|
||||
ensure_resource('file', $::cinder::params::ceph_init_override, {'ensure' => 'present'})
|
||||
|
||||
file_line { 'set initscript env':
|
||||
line => $override_line,
|
||||
path => $::cinder::params::ceph_init_override,
|
||||
notify => Service['cinder-volume'],
|
||||
}
|
||||
ensure_resource('file_line', 'set initscript env', {
|
||||
line => $override_line,
|
||||
path => $::cinder::params::ceph_init_override,
|
||||
notify => Service['cinder-volume']
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,20 @@ describe 'cinder::backend::rbd' do
|
||||
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') }
|
||||
end
|
||||
|
||||
context 'with another RBD backend' do
|
||||
let :pre_condition do
|
||||
"cinder::backend::rbd { 'ceph2':
|
||||
rbd_pool => 'volumes2',
|
||||
rbd_user => 'test'
|
||||
}"
|
||||
end
|
||||
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
|
||||
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) }
|
||||
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) }
|
||||
it { should contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
|
||||
it { should contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') }
|
||||
it { should contain_cinder_config("ceph2/rbd_user").with_value('test') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with RedHat' do
|
||||
|
||||
Reference in New Issue
Block a user