commit 776705641262532bb0c3c2e640a47c07b1e2252d Author: Takashi Kajinami Date: Mon Oct 19 19:08:54 2020 +0900 Add support to set concurrency of cinder-backup This patch introduces two new parameters, backup_workers and backup_max_operations, so that operators can set concurrency of cinder-backup process via puppet-cinder. Change-Id: I6df2a6f62b4339e65cacdcb328c374f7fca8e9fb diff --git a/manifests/backup.pp b/manifests/backup.pp index c43c844..2334414 100644 --- a/manifests/backup.pp +++ b/manifests/backup.pp @@ -28,6 +28,15 @@ # (optional) Template string to be used to generate backup names. # Defaults to $::os_service_default # +# [*backup_workers*] +# (optional) Number of backup processes to launch. +# Defaults to $::os_service_default +# +# [*backup_max_operations*] +# (optional) Maximum number of concurrent memory heavy operations: backup +# and restore. Value of 0 means unlimited. +# Defaults to $::os_service_default +# # === Author(s) # # Emilien Macchi @@ -49,12 +58,14 @@ # under the License. # class cinder::backup ( - $enabled = true, - $manage_service = true, - $package_ensure = 'present', - $backup_manager = $::os_service_default, - $backup_api_class = $::os_service_default, - $backup_name_template = $::os_service_default, + $enabled = true, + $manage_service = true, + $package_ensure = 'present', + $backup_manager = $::os_service_default, + $backup_api_class = $::os_service_default, + $backup_name_template = $::os_service_default, + $backup_workers = $::os_service_default, + $backup_max_operations = $::os_service_default, ) { include cinder::deps @@ -88,9 +99,11 @@ class cinder::backup ( } cinder_config { - 'DEFAULT/backup_manager': value => $backup_manager; - 'DEFAULT/backup_api_class': value => $backup_api_class; - 'DEFAULT/backup_name_template': value => $backup_name_template; + 'DEFAULT/backup_manager': value => $backup_manager; + 'DEFAULT/backup_api_class': value => $backup_api_class; + 'DEFAULT/backup_name_template': value => $backup_name_template; + 'DEFAULT/backup_workers': value => $backup_workers; + 'DEFAULT/backup_max_operations': value => $backup_max_operations; } } diff --git a/releasenotes/notes/backup-concurrency-bedc9f5d4645b0f3.yaml b/releasenotes/notes/backup-concurrency-bedc9f5d4645b0f3.yaml new file mode 100644 index 0000000..d10e49b --- /dev/null +++ b/releasenotes/notes/backup-concurrency-bedc9f5d4645b0f3.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The following two parameters have been added to the ``cinder::backup`` + class, to support the corresponding parameters to define concurrency of + cinder-backup. + + - ``backup_workers`` + - ``backup_max_operations`` diff --git a/spec/classes/cinder_backup_spec.rb b/spec/classes/cinder_backup_spec.rb index e100f72..398ecc4 100644 --- a/spec/classes/cinder_backup_spec.rb +++ b/spec/classes/cinder_backup_spec.rb @@ -23,11 +23,13 @@ require 'spec_helper' describe 'cinder::backup' do let :default_params do { - :enable => true, - :manage_service => true, - :backup_manager => '', - :backup_api_class => '', - :backup_name_template => '' + :enable => true, + :manage_service => true, + :backup_manager => '', + :backup_api_class => '', + :backup_name_template => '', + :backup_workers => '', + :backup_max_operations => '', } end @@ -66,14 +68,22 @@ describe 'cinder::backup' do is_expected.to contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager]) is_expected.to contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class]) is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) + is_expected.to contain_cinder_config('DEFAULT/backup_workers').with_value(p[:backup_workers]) + is_expected.to contain_cinder_config('DEFAULT/backup_max_operations').with_value(p[:backup_max_operations]) end - context 'when overriding backup_name_template' do + context 'when overriding parameters' do before :each do - params.merge!(:backup_name_template => 'foo-bar-%s') + params.merge!({ + :backup_name_template => 'foo-bar-%s', + :backup_workers => 1, + :backup_max_operations => 2, + }) end it 'should replace default parameter with new value' do is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) + is_expected.to contain_cinder_config('DEFAULT/backup_workers').with_value(p[:backup_workers]) + is_expected.to contain_cinder_config('DEFAULT/backup_max_operations').with_value(p[:backup_max_operations]) end end