From 2fa07f1ac1f508645c906ed97888801a96566fd3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 17 Dec 2021 09:20:28 +0900 Subject: [PATCH] Support tunable parameters of cinder-volume Change-Id: Ifd5db7858622a2206eff4d50e6617d438e07d0e1 --- manifests/volume.pp | 56 +++++++++++++++---- .../c-vol-tunables-84ae6003697f9eb9.yaml | 10 ++++ spec/classes/cinder_volume_spec.rb | 51 +++++++++-------- 3 files changed, 84 insertions(+), 33 deletions(-) create mode 100644 releasenotes/notes/c-vol-tunables-84ae6003697f9eb9.yaml diff --git a/manifests/volume.pp b/manifests/volume.pp index cf8f1006..f4a30b98 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -33,14 +33,43 @@ # for example "-c3" for idle only priority. # 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 ( - $package_ensure = 'present', - $enabled = true, - $manage_service = true, - $cluster = $::os_service_default, - $volume_clear = $::os_service_default, - $volume_clear_size = $::os_service_default, - $volume_clear_ionice = $::os_service_default, + $package_ensure = 'present', + $enabled = true, + $manage_service = true, + $cluster = $::os_service_default, + $volume_clear = $::os_service_default, + $volume_clear_size = $::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 @@ -74,9 +103,14 @@ class cinder::volume ( } cinder_config { - 'DEFAULT/cluster': value => $cluster; - 'DEFAULT/volume_clear': value => $volume_clear; - 'DEFAULT/volume_clear_size': value => $volume_clear_size; - 'DEFAULT/volume_clear_ionice': value => $volume_clear_ionice; + 'DEFAULT/cluster': value => $cluster; + 'DEFAULT/volume_clear': value => $volume_clear; + 'DEFAULT/volume_clear_size': value => $volume_clear_size; + '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; } } diff --git a/releasenotes/notes/c-vol-tunables-84ae6003697f9eb9.yaml b/releasenotes/notes/c-vol-tunables-84ae6003697f9eb9.yaml new file mode 100644 index 00000000..7606f111 --- /dev/null +++ b/releasenotes/notes/c-vol-tunables-84ae6003697f9eb9.yaml @@ -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`` diff --git a/spec/classes/cinder_volume_spec.rb b/spec/classes/cinder_volume_spec.rb index 8192122a..79df5c17 100644 --- a/spec/classes/cinder_volume_spec.rb +++ b/spec/classes/cinder_volume_spec.rb @@ -13,10 +13,17 @@ describe 'cinder::volume' do :tag => 'cinder-service', )} - it { is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('') } - it { is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('') } - it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('') } - it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('') } + it { + is_expected.to contain_cinder_config('DEFAULT/cluster').with_value('') + is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('') + is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('') + is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('') + is_expected.to contain_cinder_config('DEFAULT/migration_create_volume_timeout_secs').with_value('') + is_expected.to contain_cinder_config('DEFAULT/volume_service_inithost_offload').with_value('') + is_expected.to contain_cinder_config('DEFAULT/reinit_driver_count').with_value('') + is_expected.to contain_cinder_config('DEFAULT/init_host_max_objects_retrieval').with_value('') + is_expected.to contain_cinder_config('DEFAULT/backend_stats_polling_interval').with_value('') + } context 'with manage_service false' do let :params do @@ -28,31 +35,31 @@ describe 'cinder::volume' do it { is_expected.to contain_service('cinder-volume').without_ensure } end - context 'with volume_clear parameters' do + context 'with parameters overridden' do let :params do { - :volume_clear => 'none', - :volume_clear_size => '10', - :volume_clear_ionice => '-c3', - } - end - - it { - 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') - } - end - - context 'with cluster parameter' do - let :params do - { - :cluster => 'my_cluster', + :cluster => 'my_cluster', + :volume_clear => 'none', + :volume_clear_size => '10', + :volume_clear_ionice => '-c3', + :migration_create_volume_timeout_secs => 300, + :volume_service_inithost_offload => true, + :reinit_driver_count => 3, + :init_host_max_objects_retrieval => 0, + :backend_stats_polling_interval => 60, } end it { 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