Add support for cinder RBD driver parameter

Add the ability to control the rbd_flatten_volume_from_snapshot
setting in cinder's RBD driver. The parameter has been supported in
puppet-cinder for a while, and this patch makes it possible to
control the value using hiera data.

Change-Id: I430a2d1793ffcd0964d268a1930e3fb85e32a995
This commit is contained in:
Alan Bishop 2019-08-30 12:43:55 -07:00
parent 04b14abc04
commit d4affe0a5b
2 changed files with 64 additions and 51 deletions

View File

@ -51,6 +51,11 @@
# (Optional) The user name for the RBD client # (Optional) The user name for the RBD client
# Defaults to 'openstack' # 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*] # [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates # (Optional) The current step in deployment. See tripleo-heat-templates
# for more details. # for more details.
@ -67,6 +72,7 @@ class tripleo::profile::base::cinder::volume::rbd (
$cinder_rbd_extra_pools = undef, $cinder_rbd_extra_pools = undef,
$cinder_rbd_secret_uuid = undef, $cinder_rbd_secret_uuid = undef,
$cinder_rbd_user_name = 'openstack', $cinder_rbd_user_name = 'openstack',
$cinder_rbd_flatten_volume_from_snapshot = hiera('cinder::backend::rbd::flatten_volume_from_snapshot', undef),
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
) { ) {
include ::tripleo::profile::base::cinder::volume include ::tripleo::profile::base::cinder::volume
@ -79,6 +85,7 @@ class tripleo::profile::base::cinder::volume::rbd (
rbd_pool => $cinder_rbd_pool_name, rbd_pool => $cinder_rbd_pool_name,
rbd_user => $cinder_rbd_user_name, rbd_user => $cinder_rbd_user_name,
rbd_secret_uuid => $cinder_rbd_secret_uuid, rbd_secret_uuid => $cinder_rbd_secret_uuid,
rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
} }
if $cinder_rbd_extra_pools { if $cinder_rbd_extra_pools {
@ -90,6 +97,7 @@ class tripleo::profile::base::cinder::volume::rbd (
rbd_pool => $pool_name, rbd_pool => $pool_name,
rbd_user => $cinder_rbd_user_name, rbd_user => $cinder_rbd_user_name,
rbd_secret_uuid => $cinder_rbd_secret_uuid, rbd_secret_uuid => $cinder_rbd_secret_uuid,
rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
} }
} }
} }

View File

@ -45,6 +45,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_ceph_conf => '/etc/ceph/ceph.conf', :rbd_ceph_conf => '/etc/ceph/ceph.conf',
:rbd_pool => 'volumes', :rbd_pool => 'volumes',
:rbd_user => 'openstack', :rbd_user => 'openstack',
:rbd_flatten_volume_from_snapshot => '<SERVICE DEFAULT>',
) )
end end
end end
@ -59,7 +60,8 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:cinder_rbd_pool_name => 'poolname', :cinder_rbd_pool_name => 'poolname',
:cinder_rbd_extra_pools => ['aplenty', 'galore'], :cinder_rbd_extra_pools => ['aplenty', 'galore'],
:cinder_rbd_secret_uuid => 'secretuuid', :cinder_rbd_secret_uuid => 'secretuuid',
:cinder_rbd_user_name => 'kcatsnepo' :cinder_rbd_user_name => 'kcatsnepo',
:cinder_rbd_flatten_volume_from_snapshot => true,
}) })
end end
it 'should trigger complete configuration' do it 'should trigger complete configuration' do
@ -69,7 +71,8 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_ceph_conf => '/etc/ceph/mycluster.conf', :rbd_ceph_conf => '/etc/ceph/mycluster.conf',
:rbd_pool => 'poolname', :rbd_pool => 'poolname',
:rbd_user => 'kcatsnepo', :rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid' :rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
) )
is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with( is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with(
:backend_host => 'fe80::fc54:ff:fe9e:7846', :backend_host => 'fe80::fc54:ff:fe9e:7846',
@ -77,7 +80,8 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_ceph_conf => '/etc/ceph/mycluster.conf', :rbd_ceph_conf => '/etc/ceph/mycluster.conf',
:rbd_pool => 'aplenty', :rbd_pool => 'aplenty',
:rbd_user => 'kcatsnepo', :rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid' :rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
) )
is_expected.to contain_cinder__backend__rbd('poodles_galore').with( is_expected.to contain_cinder__backend__rbd('poodles_galore').with(
:backend_host => 'fe80::fc54:ff:fe9e:7846', :backend_host => 'fe80::fc54:ff:fe9e:7846',
@ -85,7 +89,8 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_ceph_conf => '/etc/ceph/mycluster.conf', :rbd_ceph_conf => '/etc/ceph/mycluster.conf',
:rbd_pool => 'galore', :rbd_pool => 'galore',
:rbd_user => 'kcatsnepo', :rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid' :rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
) )
end end
end end