diff --git a/manifests/all.pp b/manifests/all.pp index 7fc3d42..112bc06 100644 --- a/manifests/all.pp +++ b/manifests/all.pp @@ -193,6 +193,10 @@ class openstack::all ( $setup_test_volume = false, $volume_group = 'cinder-volumes', $iscsi_ip_address = '127.0.0.1', + $cinder_volume_driver = 'iscsi', + $cinder_rbd_user = 'volumes', + $cinder_rbd_pool = 'volumes', + $cinder_rbd_secret_uuid = false, # Neutron $neutron = true, $bridge_interface = undef, @@ -507,6 +511,10 @@ class openstack::all ( db_type => $db_type, db_host => $db_host, iscsi_ip_address => $iscsi_ip_address, + volume_driver => $cinder_volume_driver, + rbd_user => $cinder_rbd_user, + rbd_pool => $cinder_rbd_pool, + rbd_secret_uuid => $cinder_rbd_secret_uuid, setup_test_volume => $setup_test_volume, manage_volumes => $manage_volumes, volume_group => $volume_group, diff --git a/manifests/cinder/all.pp b/manifests/cinder/all.pp index 82613d2..8e60ade 100644 --- a/manifests/cinder/all.pp +++ b/manifests/cinder/all.pp @@ -29,6 +29,9 @@ class openstack::cinder::all( $volume_group = 'cinder-volumes', $volume_driver = 'iscsi', $iscsi_ip_address = '127.0.0.1', + $rbd_user = 'volumes', + $rbd_pool = 'volumes', + $rbd_secret_uuid = false, $setup_test_volume = false, $manage_volumes = true, $debug = false, @@ -95,6 +98,12 @@ class openstack::cinder::all( volume_name => $volume_group, } } + } elsif $volume_driver == 'rbd' { + class { 'cinder::volume::rbd': + rbd_pool => $rbd_pool, + rbd_user => $rbd_user, + rbd_secret_uuid => $rbd_secret_uuid, + } } else { warning("Unsupported volume driver: ${volume_driver}, make sure you are configuring this yourself") } diff --git a/spec/classes/openstack_all_spec.rb b/spec/classes/openstack_all_spec.rb index 8ac4d1d..c40efe5 100644 --- a/spec/classes/openstack_all_spec.rb +++ b/spec/classes/openstack_all_spec.rb @@ -225,6 +225,30 @@ describe 'openstack::all' do end end + context 'cinder enabled and Ceph RBD as the backend' do + before do + params.merge!( + :neutron_user_password => 'neutron_user_password', + :neutron_db_password => 'neutron_db_password', + :bridge_interface => 'eth0', + :ovs_local_ip => '10.0.1.1', + :metadata_shared_secret => 'shared_md_secret', + :cinder_db_password => 'cinder_db_password', + :cinder_user_password => 'cinder_user_password', + :cinder_volume_driver => 'rbd', + :cinder_rbd_secret_uuid => 'e80afa94-a64c-486c-9e34-d55e85f26406' + ) + end + + it 'should have cinder::volume::rbd' do + should contain_class('cinder::volume::rbd').with( + :rbd_pool => 'volumes', + :rbd_user => 'volumes', + :rbd_secret_uuid => 'e80afa94-a64c-486c-9e34-d55e85f26406' + ) + end + end + context 'cinder and neutron enabled (which is the default)' do before do params.merge!( diff --git a/spec/classes/openstack_cinder_all_spec.rb b/spec/classes/openstack_cinder_all_spec.rb index e3713d4..cbb0580 100644 --- a/spec/classes/openstack_cinder_all_spec.rb +++ b/spec/classes/openstack_cinder_all_spec.rb @@ -76,6 +76,24 @@ describe 'openstack::cinder::all' do it { should_not contain_class('cinder::volume::iscsi') } end + describe 'with a volume driver other than rbd' do + before do + params.merge!( + :volume_driver => 'netapp' + ) + end + it { should_not contain_class('cinder::volume::rbd') } + end + + describe 'with the rbd volume driver' do + before do + params.merge!( + :volume_driver => 'rbd' + ) + end + it { should contain_class('cinder::volume::rbd') } + end + describe 'when setting up test volumes for iscsi' do before do params.merge!(