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
This commit is contained in:
Takashi Kajinami 2020-10-19 19:08:54 +09:00
parent 6a48c51baa
commit 7767056412
3 changed files with 48 additions and 16 deletions

View File

@ -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 <emilien.macchi@enovance.com>
@ -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;
}
}

View File

@ -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``

View File

@ -23,11 +23,13 @@ require 'spec_helper'
describe 'cinder::backup' do
let :default_params do
{
:enable => true,
:manage_service => true,
:backup_manager => '<SERVICE DEFAULT>',
:backup_api_class => '<SERVICE DEFAULT>',
:backup_name_template => '<SERVICE DEFAULT>'
:enable => true,
:manage_service => true,
:backup_manager => '<SERVICE DEFAULT>',
:backup_api_class => '<SERVICE DEFAULT>',
:backup_name_template => '<SERVICE DEFAULT>',
:backup_workers => '<SERVICE DEFAULT>',
:backup_max_operations => '<SERVICE DEFAULT>',
}
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