From e1aaaf7237933f745498b0f35dfc5570cc8eb79d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 6 Jul 2021 13:30:24 +0900 Subject: [PATCH] Add support for coordination parameters The tooz library was introduced to Manila a while ago[1]. This change adds the new manila::coordination class to manage coordination parameters and backend packages. [1] 326755f42ccf0385a02db37e734251860d81b00d Depends-on: https://review.opendev.org/791628 Change-Id: I1a4c342a1d7876762af51d2c8bef87881719e598 --- manifests/coordination.pp | 20 ++++++++++ .../notes/coordination-07f3f700248c38fb.yaml | 4 ++ spec/classes/manila_coordination_spec.rb | 39 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 manifests/coordination.pp create mode 100644 releasenotes/notes/coordination-07f3f700248c38fb.yaml create mode 100644 spec/classes/manila_coordination_spec.rb diff --git a/manifests/coordination.pp b/manifests/coordination.pp new file mode 100644 index 00000000..e94ea0e5 --- /dev/null +++ b/manifests/coordination.pp @@ -0,0 +1,20 @@ +# == Class: manila::coordination +# +# Setup and configure Manila coordination settings. +# +# === Parameters +# +# [*backend_url*] +# (Optional) Coordination backend URL. +# Defaults to $::os_service_default +# +class manila::coordination ( + $backend_url = $::os_service_default, +) { + + include manila::deps + + oslo::coordination{ 'manila_config': + backend_url => $backend_url + } +} diff --git a/releasenotes/notes/coordination-07f3f700248c38fb.yaml b/releasenotes/notes/coordination-07f3f700248c38fb.yaml new file mode 100644 index 00000000..668f684c --- /dev/null +++ b/releasenotes/notes/coordination-07f3f700248c38fb.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``manila::coordination`` class has been added. diff --git a/spec/classes/manila_coordination_spec.rb b/spec/classes/manila_coordination_spec.rb new file mode 100644 index 00000000..58299e97 --- /dev/null +++ b/spec/classes/manila_coordination_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +describe 'manila::coordination' do + shared_examples 'manila::coordination' do + context 'with default parameters' do + it { + is_expected.to contain_oslo__coordination('manila_config').with( + :backend_url => '' + ) + } + end + + context 'with specified parameters' do + let :params do + { + :backend_url => 'etcd3+http://127.0.0.1:2379', + } + end + + it { + is_expected.to contain_oslo__coordination('manila_config').with( + :backend_url => 'etcd3+http://127.0.0.1:2379' + ) + } + 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 'manila::coordination' + end + end +end