Support configuring extra cinder RBD options

Add tripleo::profile::base::cinder::volume::rbd::extra_options
parameter, which provides a mechanism for configuring arbitrary
"extra options" for RBD backends. Having this capability will help
resolve problems that require adjusting arcane driver settings that
are not supported by puppet-cinder, expecially in older stable
releases.

Note: The cinder::config::cinder_config parameter also provides
a mechanism for configuring arbitrary settings in cinder.conf.
However, having a parameter dedicated for RBD backends will help
avoid situations where a user adds hiera data that sets
cinder::config::cinder_config, and inadvertently overrides any
critical RBD settings.

NOTE(stable/victoria): Backport conflicts had to be resolved
due to support for the multi_config parameter that was introduced
in stable/wallaby.

Change-Id: I7a928978205a5bd5698bebe3c1b9aae94af80057
(cherry picked from commit f6815f341d)
(cherry picked from commit f60e1c1f68)
(cherry picked from commit 74fe2876ac)
(cherry picked from commit e1fefac52e)
This commit is contained in:
Alan Bishop 2021-11-23 08:04:40 -08:00
parent 23a518abfd
commit be4718950b
3 changed files with 19 additions and 0 deletions

View File

@ -56,6 +56,11 @@
# in order to remove a dependency on the snapshot.
# Defaults to hiera('cinder::backend::rbd::flatten_volume_from_snapshot, undef)
#
# [*extra_options*]
# (optional) Hash of extra options to configure for the RBD backends.
# Example: { 'tripleo_ceph/param1' => { 'value' => value1 } }
# Defaults to: {}
#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
@ -73,6 +78,7 @@ class tripleo::profile::base::cinder::volume::rbd (
$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),
$extra_options = {},
$step = Integer(hiera('step')),
) {
include ::tripleo::profile::base::cinder::volume
@ -86,6 +92,7 @@ class tripleo::profile::base::cinder::volume::rbd (
rbd_user => $cinder_rbd_user_name,
rbd_secret_uuid => $cinder_rbd_secret_uuid,
rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
extra_options => $extra_options,
}
if $cinder_rbd_extra_pools {
@ -98,6 +105,7 @@ class tripleo::profile::base::cinder::volume::rbd (
rbd_user => $cinder_rbd_user_name,
rbd_secret_uuid => $cinder_rbd_secret_uuid,
rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
# extra_options are global, and are only applied once (not on each pool).
}
}
}

View File

@ -0,0 +1,6 @@
---
features:
- |
A new ``tripleo::profile::base::cinder::volume::rbd::extra_options``
parameter adds the ability to configure additional options for use
with cinder RBD backends.

View File

@ -62,6 +62,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:cinder_rbd_secret_uuid => 'secretuuid',
:cinder_rbd_user_name => 'kcatsnepo',
:cinder_rbd_flatten_volume_from_snapshot => true,
:extra_options => {'poodles/param1' => { 'value' => 'value1' }},
})
end
it 'should trigger complete configuration' do
@ -73,6 +74,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
:extra_options => {'poodles/param1' => { 'value' => 'value1' }},
)
is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with(
:backend_host => 'fe80::fc54:ff:fe9e:7846',
@ -82,6 +84,8 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
# extra_options are provided with only the first RBD backend/pool
:extra_options => {},
)
is_expected.to contain_cinder__backend__rbd('poodles_galore').with(
:backend_host => 'fe80::fc54:ff:fe9e:7846',
@ -91,6 +95,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
:extra_options => {},
)
end
end