Support tunable parameters of cinder-volume

Change-Id: Ifd5db7858622a2206eff4d50e6617d438e07d0e1
This commit is contained in:
Takashi Kajinami 2021-12-17 09:20:28 +09:00
parent d944a76b95
commit 2fa07f1ac1
3 changed files with 84 additions and 33 deletions

View File

@ -33,14 +33,43 @@
# for example "-c3" for idle only priority. # for example "-c3" for idle only priority.
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*migration_create_volume_timeout_secs*]
# (Optional) Timeout for creating the volume to migrate to when performing
# volume migration (seconds).
# Defaults to $::os_service_default.
#
# [*volume_service_inithost_offload*]
# (Optional) Offload pending volume delete during volume service startup.
# Defaults to $::os_service_default.
#
# [*reinit_driver_count*]
# (Optional) Maximum times to reinitialize the driver if volume
# initialization fails.
# Defaults to $::os_service_default.
#
# [*init_host_max_objects_retrieval*]
# (Optional) Max number of volumes and snapshots to be retrieved per batch
# during volume manager host initialization.
# Defaults to $::os_service_default.
#
# [*backend_stats_polling_interval*]
# (Optional) Time in seconds between requests for usage statistics from
# the backend.
# Defaults to $::os_service_default.
#
class cinder::volume ( class cinder::volume (
$package_ensure = 'present', $package_ensure = 'present',
$enabled = true, $enabled = true,
$manage_service = true, $manage_service = true,
$cluster = $::os_service_default, $cluster = $::os_service_default,
$volume_clear = $::os_service_default, $volume_clear = $::os_service_default,
$volume_clear_size = $::os_service_default, $volume_clear_size = $::os_service_default,
$volume_clear_ionice = $::os_service_default, $volume_clear_ionice = $::os_service_default,
$migration_create_volume_timeout_secs = $::os_service_default,
$volume_service_inithost_offload = $::os_service_default,
$reinit_driver_count = $::os_service_default,
$init_host_max_objects_retrieval = $::os_service_default,
$backend_stats_polling_interval = $::os_service_default,
) { ) {
include cinder::deps include cinder::deps
@ -74,9 +103,14 @@ class cinder::volume (
} }
cinder_config { cinder_config {
'DEFAULT/cluster': value => $cluster; 'DEFAULT/cluster': value => $cluster;
'DEFAULT/volume_clear': value => $volume_clear; 'DEFAULT/volume_clear': value => $volume_clear;
'DEFAULT/volume_clear_size': value => $volume_clear_size; 'DEFAULT/volume_clear_size': value => $volume_clear_size;
'DEFAULT/volume_clear_ionice': value => $volume_clear_ionice; 'DEFAULT/volume_clear_ionice': value => $volume_clear_ionice;
'DEFAULT/migration_create_volume_timeout_secs': value => $migration_create_volume_timeout_secs;
'DEFAULT/volume_service_inithost_offload': value => $volume_service_inithost_offload;
'DEFAULT/reinit_driver_count': value => $reinit_driver_count;
'DEFAULT/init_host_max_objects_retrieval': value => $init_host_max_objects_retrieval;
'DEFAULT/backend_stats_polling_interval': value => $backend_stats_polling_interval;
} }
} }

View File

@ -0,0 +1,10 @@
---
features:
- |
The ``cinder::volume`` class now supports the following parameters.
- ``migration_create_volume_timeout_secs``
- ``volume_service_inithost_offload``
- ``reinit_driver_count``
- ``init_host_max_objects_retrieval``
- ``backend_stats_polling_interval``

View File

@ -13,10 +13,17 @@ describe 'cinder::volume' do
:tag => 'cinder-service', :tag => 'cinder-service',
)} )}
it { is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('<SERVICE DEFAULT>') } it {
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('<SERVICE DEFAULT>') } is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('<SERVICE DEFAULT>')
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('<SERVICE DEFAULT>') } is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('<SERVICE DEFAULT>')
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('<SERVICE DEFAULT>') } is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/migration_create_volume_timeout_secs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/volume_service_inithost_offload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/reinit_driver_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/init_host_max_objects_retrieval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/backend_stats_polling_interval').with_value('<SERVICE DEFAULT>')
}
context 'with manage_service false' do context 'with manage_service false' do
let :params do let :params do
@ -28,31 +35,31 @@ describe 'cinder::volume' do
it { is_expected.to contain_service('cinder-volume').without_ensure } it { is_expected.to contain_service('cinder-volume').without_ensure }
end end
context 'with volume_clear parameters' do context 'with parameters overridden' do
let :params do let :params do
{ {
:volume_clear => 'none', :cluster => 'my_cluster',
:volume_clear_size => '10', :volume_clear => 'none',
:volume_clear_ionice => '-c3', :volume_clear_size => '10',
} :volume_clear_ionice => '-c3',
end :migration_create_volume_timeout_secs => 300,
:volume_service_inithost_offload => true,
it { :reinit_driver_count => 3,
is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('none') :init_host_max_objects_retrieval => 0,
is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('10') :backend_stats_polling_interval => 60,
is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('-c3')
}
end
context 'with cluster parameter' do
let :params do
{
:cluster => 'my_cluster',
} }
end end
it { it {
is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('my_cluster') is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('my_cluster')
is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('none')
is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('10')
is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('-c3')
is_expected.to contain_cinder_config('DEFAULT/migration_create_volume_timeout_secs').with_value(300)
is_expected.to contain_cinder_config('DEFAULT/volume_service_inithost_offload').with_value(true)
is_expected.to contain_cinder_config('DEFAULT/reinit_driver_count').with_value(3)
is_expected.to contain_cinder_config('DEFAULT/init_host_max_objects_retrieval').with_value(0)
is_expected.to contain_cinder_config('DEFAULT/backend_stats_polling_interval').with_value(60)
} }
end end
end end