From 5218e2ff86d5f210bbbf15f79db111c296e53ee7 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 27 Nov 2022 02:01:56 +0900 Subject: [PATCH] Support [os_brick] lock_path Recent os-brick supports supports configuration os-brick specific lock_path. This adds the new class to manage the [os_brick] lock_path option. Depends-on: https://review.opendev.org/865771 Change-Id: Ib3b914b83bb61de1592553f7b43d0eace7c26903 --- manifests/os_brick.pp | 18 ++++++++ .../notes/os_brick-d7164dfcb0319654.yaml | 5 +++ spec/classes/nova_os_brick_spec.rb | 41 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 manifests/os_brick.pp create mode 100644 releasenotes/notes/os_brick-d7164dfcb0319654.yaml create mode 100644 spec/classes/nova_os_brick_spec.rb diff --git a/manifests/os_brick.pp b/manifests/os_brick.pp new file mode 100644 index 000000000..5642c4d2f --- /dev/null +++ b/manifests/os_brick.pp @@ -0,0 +1,18 @@ +# == Class: nova::os_brick +# +# Configure os_brick options +# +# === Parameters: +# +# [*lock_path*] +# (Optional) Directory to use for os-brick lock files. +# Defaults to $facts['os_service_default'] +# +class nova::os_brick( + $lock_path = $facts['os_service_default'], +) { + + oslo::os_brick { 'nova_config': + lock_path => $lock_path + } +} diff --git a/releasenotes/notes/os_brick-d7164dfcb0319654.yaml b/releasenotes/notes/os_brick-d7164dfcb0319654.yaml new file mode 100644 index 000000000..7583bac78 --- /dev/null +++ b/releasenotes/notes/os_brick-d7164dfcb0319654.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``nova::os_brick`` class has been added. This class manages + the ``[os_brick]`` options. diff --git a/spec/classes/nova_os_brick_spec.rb b/spec/classes/nova_os_brick_spec.rb new file mode 100644 index 000000000..2b5fa6732 --- /dev/null +++ b/spec/classes/nova_os_brick_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +describe 'nova::os_brick' do + + shared_examples 'nova::os_brick' do + + context 'with defaults' do + it 'configures the default values' do + is_expected.to contain_oslo__os_brick('nova_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('nova_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 'nova::os_brick' + end + end +end