3 describe 'cinder::backend::rbd' do
5 let(:title) {'rbd-ssd'}
9 :volume_backend_name => 'rbd-ssd',
10 :rbd_pool => 'volumes',
11 :glance_api_version => '2',
13 :rbd_secret_uuid => '0123456789',
14 :rbd_ceph_conf => '/foo/boo/zoo/ceph.conf',
15 :rbd_flatten_volume_from_snapshot => true,
16 :volume_tmp_dir => '/foo/tmp',
17 :rbd_max_clone_depth => '0'
21 it { should contain_class('cinder::params') }
28 {:osfamily => 'Debian'}
31 describe 'rbd backend volume driver' do
32 it 'configure rbd volume driver' do
33 should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_backend_name").with_value(req_params[:volume_backend_name])
34 should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver')
35 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_ceph_conf").with_value(req_params[:rbd_ceph_conf])
36 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_flatten_volume_from_snapshot").with_value(req_params[:rbd_flatten_volume_from_snapshot])
37 should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_value(req_params[:volume_tmp_dir])
38 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_max_clone_depth").with_value(req_params[:rbd_max_clone_depth])
39 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool])
40 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user])
41 should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid])
42 should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
43 should contain_file_line('set initscript env').with(
44 :line => /env CEPH_ARGS=\"--id test\"/,
45 :path => '/etc/init/cinder-volume.override',
46 :notify => 'Service[cinder-volume]')
49 context 'with rbd_secret_uuid disabled' do
50 let(:params) { req_params.merge!({:rbd_secret_uuid => false}) }
51 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_ensure('absent') }
54 context 'with volume_tmp_dir disabled' do
55 let(:params) { req_params.merge!({:volume_tmp_dir => false}) }
56 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') }
59 context 'with another RBD backend' do
61 "cinder::backend::rbd { 'ceph2':
62 rbd_pool => 'volumes2',
66 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
67 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) }
68 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) }
69 it { should contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
70 it { should contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') }
71 it { should contain_cinder_config("ceph2/rbd_user").with_value('test') }
75 describe 'with RedHat' do
77 { :osfamily => 'RedHat' }
84 it 'should ensure that the cinder-volume sysconfig file is present' do
85 should contain_file('/etc/sysconfig/openstack-cinder-volume').with(
90 it 'should configure RedHat init override' do
91 should contain_file_line('set initscript env').with(
92 :line => /export CEPH_ARGS=\"--id test\"/,
93 :path => '/etc/sysconfig/openstack-cinder-volume',
94 :notify => 'Service[cinder-volume]')