Configure corosync cluster-recheck-interval
Add the cluster_recheck_interval param with a 190 sec default, configurable via hiera. Add rspec and noop tests. Closes-bug: #1517388 Change-Id: I82b7220e24282d1fbda69ed7d3788e2bdc0afcfc Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
parent
fcd57d9107
commit
372b371230
@ -3,8 +3,9 @@
|
||||
# Module for configuring cluster resources.
|
||||
#
|
||||
class cluster (
|
||||
$internal_address = '127.0.0.1',
|
||||
$corosync_nodes = undef,
|
||||
$internal_address = '127.0.0.1',
|
||||
$corosync_nodes = undef,
|
||||
$cluster_recheck_interval = '190s',
|
||||
) {
|
||||
|
||||
#todo: move half of openstack::corosync
|
||||
@ -12,18 +13,20 @@ class cluster (
|
||||
|
||||
if defined(Stage['corosync_setup']) {
|
||||
class { 'openstack::corosync':
|
||||
bind_address => $internal_address,
|
||||
corosync_nodes => $corosync_nodes,
|
||||
stage => 'corosync_setup',
|
||||
corosync_version => '2',
|
||||
packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'],
|
||||
bind_address => $internal_address,
|
||||
corosync_nodes => $corosync_nodes,
|
||||
stage => 'corosync_setup',
|
||||
corosync_version => '2',
|
||||
packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'],
|
||||
cluster_recheck_interval => $cluster_recheck_interval,
|
||||
}
|
||||
} else {
|
||||
class { 'openstack::corosync':
|
||||
bind_address => $internal_address,
|
||||
corosync_nodes => $corosync_nodes,
|
||||
corosync_version => '2',
|
||||
packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'],
|
||||
bind_address => $internal_address,
|
||||
corosync_nodes => $corosync_nodes,
|
||||
corosync_version => '2',
|
||||
packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'],
|
||||
cluster_recheck_interval => $cluster_recheck_interval,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,8 @@ require 'spec_helper'
|
||||
describe 'cluster' do
|
||||
|
||||
let(:default_params) { {
|
||||
:internal_address => '127.0.0.1',
|
||||
:internal_address => '127.0.0.1',
|
||||
:cluster_recheck_interval => '190s',
|
||||
} }
|
||||
|
||||
shared_examples_for 'cluster configuration' do
|
||||
@ -22,10 +23,11 @@ describe 'cluster' do
|
||||
it 'configures with the params params' do
|
||||
should contain_class('cluster')
|
||||
should contain_class('openstack::corosync').with(
|
||||
:bind_address => '127.0.0.1',
|
||||
:corosync_nodes => params[:corosync_nodes],
|
||||
:corosync_version => 2,
|
||||
:packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'])
|
||||
:bind_address => '127.0.0.1',
|
||||
:corosync_nodes => params[:corosync_nodes],
|
||||
:corosync_version => 2,
|
||||
:packages => ['corosync', 'pacemaker', 'crmsh', 'pcs'],
|
||||
:cluster_recheck_interval => params[:cluster_recheck_interval])
|
||||
should contain_file('ocf-fuel-path').with(
|
||||
:ensure => 'directory',
|
||||
:path => '/usr/lib/ocf/resource.d/fuel',
|
||||
|
@ -49,3 +49,5 @@ fixtures:
|
||||
'rsyslog': "#{source_dir}/../rsyslog"
|
||||
'mysql': "#{source_dir}/../mysql"
|
||||
'tweaks': "#{source_dir}/../tweaks"
|
||||
'corosync': "#{source_dir}/../corosync"
|
||||
'pacemaker': "#{source_dir}/../pacemaker"
|
||||
|
@ -1,13 +1,14 @@
|
||||
class openstack::corosync (
|
||||
$bind_address = '127.0.0.1',
|
||||
$multicast_address = '239.1.1.2',
|
||||
$secauth = false,
|
||||
$stonith = false,
|
||||
$quorum_policy = 'ignore',
|
||||
$expected_quorum_votes = '2',
|
||||
$corosync_nodes = undef,
|
||||
$corosync_version = '1',
|
||||
$packages = ['corosync', 'pacemaker'],
|
||||
$bind_address = '127.0.0.1',
|
||||
$multicast_address = '239.1.1.2',
|
||||
$secauth = false,
|
||||
$stonith = false,
|
||||
$quorum_policy = 'ignore',
|
||||
$expected_quorum_votes = '2',
|
||||
$corosync_nodes = undef,
|
||||
$corosync_version = '1',
|
||||
$packages = ['corosync', 'pacemaker'],
|
||||
$cluster_recheck_interval = '190s',
|
||||
) {
|
||||
|
||||
file { 'limitsconf':
|
||||
@ -80,5 +81,9 @@ class openstack::corosync (
|
||||
value => false,
|
||||
} -> Anchor['corosync-done']
|
||||
|
||||
cs_property { 'cluster-recheck-interval':
|
||||
value => $cluster_recheck_interval,
|
||||
} -> Anchor['corosync-done']
|
||||
|
||||
anchor {'corosync-done':}
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'openstack::corosync' do
|
||||
|
||||
let(:default_params) { {
|
||||
:bind_address => '127.0.0.1',
|
||||
:multicast_address => '239.1.1.2',
|
||||
:secauth => false,
|
||||
:stonith => false,
|
||||
:quorum_policy => 'ignore',
|
||||
:expected_quorum_votes => '2',
|
||||
:corosync_nodes => ["UNSET"],
|
||||
:corosync_version => '1',
|
||||
:packages => ['corosync', 'pacemaker'],
|
||||
:cluster_recheck_interval => '190s'
|
||||
} }
|
||||
|
||||
let(:params) { {} }
|
||||
|
||||
shared_examples_for 'corosync configuration' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'contains openstack::corosync' do
|
||||
should contain_class('openstack::corosync')
|
||||
end
|
||||
|
||||
context 'with default params' do
|
||||
it 'configures with the default params' do
|
||||
should contain_class('corosync').with(
|
||||
:enable_secauth => p[:secauth],
|
||||
:bind_address => p[:bind_address],
|
||||
:multicast_address => p[:multicast_address],
|
||||
:corosync_nodes => p[:corosync_nodes],
|
||||
:corosync_version => p[:corosync_version],
|
||||
:packages => p[:packages],
|
||||
:debug => false,
|
||||
).that_comes_before('Anchor[corosync-done]')
|
||||
should contain_file("limitsconf").that_comes_before(
|
||||
'Service[corosync]')
|
||||
should contain_corosync__service('pacemaker').with(
|
||||
:version => '0'
|
||||
).that_notifies('Service[corosync]')
|
||||
{
|
||||
'no-quorum-policy' => p[:quorum_policy],
|
||||
'stonith-enabled' => p[:stonith],
|
||||
'start-failure-is-fatal' => false,
|
||||
'symmetric-cluster' => false,
|
||||
'cluster-recheck-interval' => p[:cluster_recheck_interval],
|
||||
}.each do |prop, val|
|
||||
should contain_cs_property(prop).with(
|
||||
:ensure => 'present',
|
||||
:provider => 'crm',
|
||||
:value => val,
|
||||
).that_comes_before('Anchor[corosync-done]')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:hostname => 'hostname.example.com', }
|
||||
end
|
||||
|
||||
it_configures 'corosync configuration'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:hostname => 'hostname.example.com', }
|
||||
end
|
||||
|
||||
it_configures 'corosync configuration'
|
||||
end
|
||||
|
||||
end
|
@ -13,10 +13,12 @@ $corosync_nodes = corosync_nodes(
|
||||
),
|
||||
'mgmt/corosync'
|
||||
)
|
||||
$cluster_recheck_interval = hiera('cluster_recheck_interval', '190s')
|
||||
|
||||
class { 'cluster':
|
||||
internal_address => get_network_role_property('mgmt/corosync', 'ipaddr'),
|
||||
corosync_nodes => $corosync_nodes,
|
||||
internal_address => get_network_role_property('mgmt/corosync', 'ipaddr'),
|
||||
corosync_nodes => $corosync_nodes,
|
||||
cluster_recheck_interval => $cluster_recheck_interval,
|
||||
}
|
||||
|
||||
pcmk_nodes { 'pacemaker' :
|
||||
|
@ -5,7 +5,12 @@ manifest = 'cluster/cluster.pp'
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
|
||||
it { should contain_class('cluster') }
|
||||
cluster_recheck_interval = Noop.hiera('cluster_recheck_interval', '190s')
|
||||
|
||||
it { should contain_class('cluster').with({
|
||||
'cluster_recheck_interval' => cluster_recheck_interval,
|
||||
})
|
||||
}
|
||||
it { should contain_pcmk_nodes('pacemaker') }
|
||||
it { should contain_service('corosync').that_comes_before('Pcmk_nodes[pacemaker]') }
|
||||
it { should contain_service('corosync').with({
|
||||
|
Loading…
Reference in New Issue
Block a user