diff --git a/manifests/profile/base/cinder/volume/rbd.pp b/manifests/profile/base/cinder/volume/rbd.pp index b6dd2bbd2..fdd13133c 100644 --- a/manifests/profile/base/cinder/volume/rbd.pp +++ b/manifests/profile/base/cinder/volume/rbd.pp @@ -51,45 +51,53 @@ # (Optional) The user name for the RBD client # Defaults to 'openstack' # +# [*cinder_rbd_flatten_volume_from_snapshot*] +# (Optional) Whether volumes created from a snapshot should be flattened +# in order to remove a dependency on the snapshot. +# Defaults to hiera('cinder::backend::rbd::flatten_volume_from_snapshot, undef) +# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. # Defaults to hiera('step') # class tripleo::profile::base::cinder::volume::rbd ( - $backend_name = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph'), - $backend_availability_zone = hiera('cinder::backend::rbd::backend_availability_zone', undef), + $backend_name = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph'), + $backend_availability_zone = hiera('cinder::backend::rbd::backend_availability_zone', undef), # lint:ignore:parameter_documentation - $cinder_rbd_backend_host = hiera('cinder::backend_host', hiera('cinder::host', $::hostname)), + $cinder_rbd_backend_host = hiera('cinder::backend_host', hiera('cinder::host', $::hostname)), # lint:endignore - $cinder_rbd_ceph_conf = hiera('cinder::backend::rbd::rbd_ceph_conf', '/etc/ceph/ceph.conf'), - $cinder_rbd_pool_name = 'volumes', - $cinder_rbd_extra_pools = undef, - $cinder_rbd_secret_uuid = undef, - $cinder_rbd_user_name = 'openstack', - $step = Integer(hiera('step')), + $cinder_rbd_ceph_conf = hiera('cinder::backend::rbd::rbd_ceph_conf', '/etc/ceph/ceph.conf'), + $cinder_rbd_pool_name = 'volumes', + $cinder_rbd_extra_pools = undef, + $cinder_rbd_secret_uuid = undef, + $cinder_rbd_user_name = 'openstack', + $cinder_rbd_flatten_volume_from_snapshot = hiera('cinder::backend::rbd::flatten_volume_from_snapshot', undef), + $step = Integer(hiera('step')), ) { include ::tripleo::profile::base::cinder::volume if $step >= 4 { cinder::backend::rbd { $backend_name : - backend_availability_zone => $backend_availability_zone, - backend_host => $cinder_rbd_backend_host, - rbd_ceph_conf => $cinder_rbd_ceph_conf, - rbd_pool => $cinder_rbd_pool_name, - rbd_user => $cinder_rbd_user_name, - rbd_secret_uuid => $cinder_rbd_secret_uuid, + backend_availability_zone => $backend_availability_zone, + backend_host => $cinder_rbd_backend_host, + rbd_ceph_conf => $cinder_rbd_ceph_conf, + rbd_pool => $cinder_rbd_pool_name, + rbd_user => $cinder_rbd_user_name, + rbd_secret_uuid => $cinder_rbd_secret_uuid, + rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot, } if $cinder_rbd_extra_pools { $cinder_rbd_extra_pools.each |$pool_name| { cinder::backend::rbd { "${backend_name}_${pool_name}" : - backend_availability_zone => $backend_availability_zone, - backend_host => $cinder_rbd_backend_host, - rbd_ceph_conf => $cinder_rbd_ceph_conf, - rbd_pool => $pool_name, - rbd_user => $cinder_rbd_user_name, - rbd_secret_uuid => $cinder_rbd_secret_uuid, + backend_availability_zone => $backend_availability_zone, + backend_host => $cinder_rbd_backend_host, + rbd_ceph_conf => $cinder_rbd_ceph_conf, + rbd_pool => $pool_name, + rbd_user => $cinder_rbd_user_name, + rbd_secret_uuid => $cinder_rbd_secret_uuid, + rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot, } } } diff --git a/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb index 416aa787b..44e802687 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb @@ -41,10 +41,11 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do context 'with defaults' do it 'should trigger complete configuration' do is_expected.to contain_cinder__backend__rbd('tripleo_ceph').with( - :backend_host => 'node.example.com', - :rbd_ceph_conf => '/etc/ceph/ceph.conf', - :rbd_pool => 'volumes', - :rbd_user => 'openstack', + :backend_host => 'node.example.com', + :rbd_ceph_conf => '/etc/ceph/ceph.conf', + :rbd_pool => 'volumes', + :rbd_user => 'openstack', + :rbd_flatten_volume_from_snapshot => '', ) end end @@ -52,40 +53,44 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do context 'with customizations' do before :each do params.merge!({ - :backend_name => 'poodles', - :backend_availability_zone => 'my_zone', - :cinder_rbd_backend_host => 'fe80::fc54:ff:fe9e:7846', - :cinder_rbd_ceph_conf => '/etc/ceph/mycluster.conf', - :cinder_rbd_pool_name => 'poolname', - :cinder_rbd_extra_pools => ['aplenty', 'galore'], - :cinder_rbd_secret_uuid => 'secretuuid', - :cinder_rbd_user_name => 'kcatsnepo' + :backend_name => 'poodles', + :backend_availability_zone => 'my_zone', + :cinder_rbd_backend_host => 'fe80::fc54:ff:fe9e:7846', + :cinder_rbd_ceph_conf => '/etc/ceph/mycluster.conf', + :cinder_rbd_pool_name => 'poolname', + :cinder_rbd_extra_pools => ['aplenty', 'galore'], + :cinder_rbd_secret_uuid => 'secretuuid', + :cinder_rbd_user_name => 'kcatsnepo', + :cinder_rbd_flatten_volume_from_snapshot => true, }) end it 'should trigger complete configuration' do is_expected.to contain_cinder__backend__rbd('poodles').with( - :backend_host => 'fe80::fc54:ff:fe9e:7846', - :backend_availability_zone => 'my_zone', - :rbd_ceph_conf => '/etc/ceph/mycluster.conf', - :rbd_pool => 'poolname', - :rbd_user => 'kcatsnepo', - :rbd_secret_uuid => 'secretuuid' + :backend_host => 'fe80::fc54:ff:fe9e:7846', + :backend_availability_zone => 'my_zone', + :rbd_ceph_conf => '/etc/ceph/mycluster.conf', + :rbd_pool => 'poolname', + :rbd_user => 'kcatsnepo', + :rbd_secret_uuid => 'secretuuid', + :rbd_flatten_volume_from_snapshot => true, ) is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with( - :backend_host => 'fe80::fc54:ff:fe9e:7846', - :backend_availability_zone => 'my_zone', - :rbd_ceph_conf => '/etc/ceph/mycluster.conf', - :rbd_pool => 'aplenty', - :rbd_user => 'kcatsnepo', - :rbd_secret_uuid => 'secretuuid' + :backend_host => 'fe80::fc54:ff:fe9e:7846', + :backend_availability_zone => 'my_zone', + :rbd_ceph_conf => '/etc/ceph/mycluster.conf', + :rbd_pool => 'aplenty', + :rbd_user => 'kcatsnepo', + :rbd_secret_uuid => 'secretuuid', + :rbd_flatten_volume_from_snapshot => true, ) is_expected.to contain_cinder__backend__rbd('poodles_galore').with( - :backend_host => 'fe80::fc54:ff:fe9e:7846', - :backend_availability_zone => 'my_zone', - :rbd_ceph_conf => '/etc/ceph/mycluster.conf', - :rbd_pool => 'galore', - :rbd_user => 'kcatsnepo', - :rbd_secret_uuid => 'secretuuid' + :backend_host => 'fe80::fc54:ff:fe9e:7846', + :backend_availability_zone => 'my_zone', + :rbd_ceph_conf => '/etc/ceph/mycluster.conf', + :rbd_pool => 'galore', + :rbd_user => 'kcatsnepo', + :rbd_secret_uuid => 'secretuuid', + :rbd_flatten_volume_from_snapshot => true, ) end end