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.

Change-Id: I7a928978205a5bd5698bebe3c1b9aae94af80057
This commit is contained in:
Alan Bishop 2021-11-23 08:04:40 -08:00
parent 1d108772fd
commit f6815f341d
3 changed files with 33 additions and 1 deletions

View File

@ -60,6 +60,11 @@
# (Optional) A config hash when multiple backends are used.
# Defaults to {}
#
# [*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.
@ -78,6 +83,7 @@ class tripleo::profile::base::cinder::volume::rbd (
$cinder_rbd_user_name = 'openstack',
$cinder_rbd_flatten_volume_from_snapshot = hiera('cinder::backend::rbd::flatten_volume_from_snapshot', undef),
$multi_config = {},
$extra_options = {},
$step = Integer(hiera('step')),
) {
include tripleo::profile::base::cinder::volume
@ -92,7 +98,8 @@ class tripleo::profile::base::cinder::volume::rbd (
'CinderRbdFlattenVolumeFromSnapshot' => $cinder_rbd_flatten_volume_from_snapshot,
}
any2array($backend_name).each |String $backend| {
$backends_array = any2array($backend_name)
$backends_array.each |String $backend| {
$backend_multi_config = pick($multi_config[$backend], {})
$multi_config_cluster = $backend_multi_config['CephClusterName']
@ -102,6 +109,13 @@ class tripleo::profile::base::cinder::volume::rbd (
$backend_ceph_conf = $cinder_rbd_ceph_conf
}
# Ensure extra_options are only applied once.
if $backend == $backends_array[0] {
$extra_options_real = $extra_options
} else {
$extra_options_real = undef
}
$backend_config = merge($backend_defaults, $backend_multi_config)
create_resources('cinder::backend::rbd', { $backend => delete_undef_values({
@ -112,6 +126,7 @@ class tripleo::profile::base::cinder::volume::rbd (
'rbd_user' => $backend_config['CephClientUserName'],
'rbd_secret_uuid' => $backend_config['CephClusterFSID'],
'rbd_flatten_volume_from_snapshot' => $backend_config['CinderRbdFlattenVolumeFromSnapshot'],
'extra_options' => $extra_options_real,
})})
any2array($backend_config['CinderRbdExtraPools']).each |String $pool_name| {

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
@ -111,6 +116,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
'CinderRbdFlattenVolumeFromSnapshot' => true,
},
},
:extra_options => {'poodles/param1' => { 'value' => 'value1' }},
})
end
it 'should configure each backend' do
@ -121,6 +127,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_pool => 'volumes',
:rbd_user => 'openstack',
:rbd_flatten_volume_from_snapshot => '<SERVICE DEFAULT>',
:extra_options => {'poodles/param1' => { 'value' => 'value1' }},
)
is_expected.to contain_cinder__backend__rbd('rbd2').with(
@ -131,6 +138,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('rbd2_pool2b').with(
@ -141,6 +150,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
:rbd_user => 'kcatsnepo',
:rbd_secret_uuid => 'secretuuid',
:rbd_flatten_volume_from_snapshot => true,
:extra_options => {},
)
is_expected.to contain_cinder__backend__rbd('rbd2_pool2c').with(
@ -151,6 +161,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