From 7ff34516ee8c64154c196e63fce2a486c3971bf9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 27 Nov 2022 01:58:00 +0900 Subject: [PATCH] Support [os_brick] options Cinder now supports configuration os-brick specific lock_path. This adds the new class to manage the [os_brick] option. Depends-on: https://review.opendev.org/849325 Depends-on: https://review.opendev.org/865771 Change-Id: I72a1cf7b982e96665b1d05170da223ebc4148281 --- manifests/os_brick.pp | 18 ++++++++ .../notes/os_brick-cbe9075c663bb2a8.yaml | 5 +++ spec/classes/cinder_os_brick_spec.rb | 41 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 manifests/os_brick.pp create mode 100644 releasenotes/notes/os_brick-cbe9075c663bb2a8.yaml create mode 100644 spec/classes/cinder_os_brick_spec.rb diff --git a/manifests/os_brick.pp b/manifests/os_brick.pp new file mode 100644 index 00000000..e1e370a7 --- /dev/null +++ b/manifests/os_brick.pp @@ -0,0 +1,18 @@ +# == Class: cinder::os_brick +# +# Configure os_brick options +# +# === Parameters: +# +# [*lock_path*] +# (Optional) Directory to use for os-brick lock files. +# Defaults to $::os_service_default +# +class cinder::os_brick( + $lock_path = $::os_service_default, +) { + + oslo::os_brick { 'cinder_config': + lock_path => $lock_path + } +} diff --git a/releasenotes/notes/os_brick-cbe9075c663bb2a8.yaml b/releasenotes/notes/os_brick-cbe9075c663bb2a8.yaml new file mode 100644 index 00000000..e0cb0142 --- /dev/null +++ b/releasenotes/notes/os_brick-cbe9075c663bb2a8.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``cinder::os_brick`` class has been added. This class manages + the ``[os_brick]`` options. diff --git a/spec/classes/cinder_os_brick_spec.rb b/spec/classes/cinder_os_brick_spec.rb new file mode 100644 index 00000000..ac170733 --- /dev/null +++ b/spec/classes/cinder_os_brick_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +describe 'cinder::os_brick' do + + shared_examples 'cinder::os_brick' do + + context 'with defaults' do + it 'configures the default values' do + is_expected.to contain_oslo__os_brick('cinder_config').with( + :lock_path => '', + ) + end + end + + context 'with parameters overridden' do + let :params do + { + :lock_path => '/var/lib/openstack/lock' + } + end + + it 'configures the overridden values' do + is_expected.to contain_oslo__os_brick('cinder_config').with( + :lock_path => '/var/lib/openstack/lock', + ) + end + 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 + + include_examples 'cinder::os_brick' + end + end +end