Merge "Fix sysinfo resource declaration"

This commit is contained in:
Jenkins 2015-10-12 11:02:26 +00:00 committed by Gerrit Code Review
commit e278123d71
3 changed files with 24 additions and 37 deletions

View File

@ -4,11 +4,6 @@
#
# === Parameters
#
# [*primary_controller*]
# (required) Boolean to indicate if this is the primary controller or not. The
# resources only get defined on the primary controller for the cluster but the
# location is defined on any node on this cluster that this should run on.
#
# [*disks*]
# (optional) array of mount points to monitor for free space. / is monitored
# by default it does not need to be specified.
@ -31,7 +26,6 @@
# Defaults to present
#
class cluster::sysinfo (
$primary_controller,
$disks = [],
$min_disk_free = '100M',
$disk_unit = 'M',
@ -39,32 +33,31 @@ class cluster::sysinfo (
$monitor_ensure = present,
) {
if $primary_controller {
cs_resource { 'sysinfo':
ensure => $monitor_ensure,
primitive_class => 'ocf',
provided_by => 'pacemaker',
primitive_type => 'SysInfo',
complex_type => 'clone',
parameters => {
'disks' => join(any2array($disks), ' '),
'min_disk_free' => $min_disk_free,
'disk_unit' => $disk_unit,
},
operations => { 'monitor' => { 'interval' => $monitor_interval } },
}
# Have service migrate if health turns red from the failed disk check
cs_property { 'node-health-strategy':
ensure => present,
value => 'migrate-on-red',
provider => 'crm',
}
# NOTE: We do not use a clone resource here as disks may be different per host
cs_resource { "sysinfo_${::fqdn}":
ensure => $monitor_ensure,
primitive_class => 'ocf',
provided_by => 'pacemaker',
primitive_type => 'SysInfo',
parameters => {
'disks' => join(any2array($disks), ' '),
'min_disk_free' => $min_disk_free,
'disk_unit' => $disk_unit,
},
operations => { 'monitor' => { 'interval' => $monitor_interval } },
}
cs_location { "clone_sysinfo-on-${::fqdn}":
primitive => 'clone_sysinfo',
node_name => $::fqdn,
score => 'INFINITY',
# Have service migrate if health turns red from the failed disk check
cs_property { 'node-health-strategy':
ensure => present,
value => 'migrate-on-red',
provider => 'crm',
}
cs_rsc_location { "sysinfo-on-${::fqdn}":
primitive => "sysinfo_${::fqdn}",
node_name => $::fqdn,
node_score => 'INFINITY',
cib => "sysinfo_${::fqdn}",
}
}

View File

@ -7,14 +7,12 @@ if !(hiera('role') in hiera('corosync_roles')) {
# load the mounted filesystems from our custom fact, remove boot
$mount_points = delete(split($::mounts, ','), '/boot')
$primary_controller = hiera('primary_controller')
$disks = hiera('corosync_disks', $mount_points)
$min_disk_free = hiera('corosync_min_disk_space', '100M')
$disk_unit = hiera('corosync_disk_unit', 'M')
$monitor_interval = hiera('corosync_disk_monitor_interval', '30s')
class { 'cluster::sysinfo':
primary_controller => $primary_controller,
disks => $disks,
min_disk_free => $min_disk_free,
disk_unit => $disk_unit,

View File

@ -4,9 +4,6 @@ manifest = 'cluster/health.pp'
describe manifest do
shared_examples 'catalog' do
let(:primary_controller) do
Noop.hiera 'primary_controller'
end
let(:facts) {
Noop.ubuntu_facts.merge({
:mounts => '/,/boot,/var/log,/var/lib/glance,/var/lib/mysql'
@ -31,7 +28,6 @@ describe manifest do
it {
should contain_class('cluster::sysinfo').with(
:primary_controller => primary_controller,
:disks => disks,
:min_disk_free => min_disk_free,
:disk_unit => disk_unit,