Support to configure cinder backend_defaults

This patch introduces a new Class cinder::backend::defaults, that
provides a way to configure parameters for all cinder
backends by default in [backend_defaults] section of
cinder configuration file.

This parameter use_multipath_for_image_xfer is supported currently.

Change-Id: Ie7cb0c11a2b9526b61a70a5f359862a24723026c
This commit is contained in:
katarimanoj 2022-06-14 06:22:49 +05:30
parent 105b9c2da5
commit 3a9a21fc09
4 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,21 @@
# == Class: cinder::backend::defaults
#
# Cinder backend defaults
#
# === Parameters
#
# [*use_multipath_for_image_xfer*]
# (Optional) Whether to use multipath during create-volume-from-image and
# copy-volume-to-image operations.
# Defaults to $::os_service_default
#
class cinder::backend::defaults (
$use_multipath_for_image_xfer = $::os_service_default,
) {
include cinder::deps
cinder_config {
'backend_defaults/use_multipath_for_image_xfer': value => $use_multipath_for_image_xfer;
}
}

View File

@ -0,0 +1,7 @@
---
features:
- |
Introduce a new Class cinder::backend::defaults, that provides a
way to configure parameters for all cinder backends in [backend_defaults]
section of cinder configuration file.
This parameter ``use_multipath_for_image_xfer`` is supported currently.

View File

@ -0,0 +1,30 @@
require 'spec_helper'
describe 'cinder::backend::defaults' do
shared_examples 'cinder backend defaults' do
context 'configure cinder with default backend_defaults parameters' do
it { is_expected.to contain_cinder_config('backend_defaults/use_multipath_for_image_xfer').with_value('<SERVICE DEFAULT>') }
end
context 'configure cinder with user defined backend_defaults parameters' do
let(:params) do
{ :use_multipath_for_image_xfer => true, }
end
it { is_expected.to contain_cinder_config('backend_defaults/use_multipath_for_image_xfer').with_value(true) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts)
end
it_behaves_like 'cinder backend defaults'
end
end
end

View File

@ -71,7 +71,7 @@ describe 'cinder::backends' do
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do