Add ability to configure cinder-volume for active-active

Add the ability to configure the cluster name, and the backend URL used
for coordination locks.

Change-Id: I431c0f7bfa766356b7ec04bf2c4d5f830c1780a2
This commit is contained in:
Alan Bishop 2018-11-16 13:06:27 -05:00
parent 8e0decd943
commit 9eb2b6329c
5 changed files with 80 additions and 0 deletions

20
manifests/coordination.pp Normal file
View File

@ -0,0 +1,20 @@
# == Class: cinder::coordination
#
# Setup and configure Cinder coordination settings.
#
# === Parameters
#
# [*backend_url*]
# (Optional) Coordination backend URL.
# Defaults to $::os_service_default
#
class cinder::coordination (
$backend_url = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'coordination/backend_url': value => $backend_url;
}
}

View File

@ -14,6 +14,10 @@
# (Optional) Whether to start/stop the service (boolean value)
# Defaults to true.
#
# [*cluster*]
# (Optional) Cluster name when running in active/active mode.
# Defaults to $::os_service_default.
#
# [*volume_clear*]
# (Optional) Method used to wipe old volumes.
# Defaults to $::os_service_default.
@ -33,6 +37,7 @@ class cinder::volume (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$cluster = $::os_service_default,
$volume_clear = $::os_service_default,
$volume_clear_size = $::os_service_default,
$volume_clear_ionice = $::os_service_default,
@ -69,6 +74,7 @@ class cinder::volume (
}
cinder_config {
'DEFAULT/cluster': value => $cluster;
'DEFAULT/volume_clear': value => $volume_clear;
'DEFAULT/volume_clear_size': value => $volume_clear_size;
'DEFAULT/volume_clear_ionice': value => $volume_clear_ionice;

View File

@ -0,0 +1,6 @@
---
features:
- |
Add support for configuring the settings necessary for running the
cinder-volume service in active-active mode. This includes configuring the
cluster name, and the backend URL used for distributed coordination.

View File

@ -0,0 +1,35 @@
require 'spec_helper'
describe 'cinder::coordination' do
shared_examples 'cinder::coordination' do
context 'with default parameters' do
it {
should contain_cinder_config('coordination/backend_url').with_value('<SERVICE DEFAULT>')
}
end
context 'with specified parameters' do
let :params do
{
:backend_url => 'etcd3+http://127.0.0.1:2379',
}
end
it {
should contain_cinder_config('coordination/backend_url').with_value('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 'cinder::coordination'
end
end
end

View File

@ -13,6 +13,7 @@ describe 'cinder::volume' do
:tag => 'cinder-service',
)}
it { should contain_cinder_config('DEFAULT/cluster').with_value('<SERVICE DEFAULT>') }
it { should contain_cinder_config('DEFAULT/volume_clear').with_value('<SERVICE DEFAULT>') }
it { should contain_cinder_config('DEFAULT/volume_clear_size').with_value('<SERVICE DEFAULT>') }
it { should contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('<SERVICE DEFAULT>') }
@ -42,6 +43,18 @@ describe 'cinder::volume' do
should contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('-c3')
}
end
context 'with cluster parameter' do
let :params do
{
:cluster => 'my_cluster',
}
end
it {
should contain_cinder_config('DEFAULT/cluster').with_value('my_cluster')
}
end
end
shared_examples 'cinder::volume on Debian' do