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 # === 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*] # [*disks*]
# (optional) array of mount points to monitor for free space. / is monitored # (optional) array of mount points to monitor for free space. / is monitored
# by default it does not need to be specified. # by default it does not need to be specified.
@ -31,7 +26,6 @@
# Defaults to present # Defaults to present
# #
class cluster::sysinfo ( class cluster::sysinfo (
$primary_controller,
$disks = [], $disks = [],
$min_disk_free = '100M', $min_disk_free = '100M',
$disk_unit = 'M', $disk_unit = 'M',
@ -39,13 +33,12 @@ class cluster::sysinfo (
$monitor_ensure = present, $monitor_ensure = present,
) { ) {
if $primary_controller { # NOTE: We do not use a clone resource here as disks may be different per host
cs_resource { 'sysinfo': cs_resource { "sysinfo_${::fqdn}":
ensure => $monitor_ensure, ensure => $monitor_ensure,
primitive_class => 'ocf', primitive_class => 'ocf',
provided_by => 'pacemaker', provided_by => 'pacemaker',
primitive_type => 'SysInfo', primitive_type => 'SysInfo',
complex_type => 'clone',
parameters => { parameters => {
'disks' => join(any2array($disks), ' '), 'disks' => join(any2array($disks), ' '),
'min_disk_free' => $min_disk_free, 'min_disk_free' => $min_disk_free,
@ -60,11 +53,11 @@ class cluster::sysinfo (
value => 'migrate-on-red', value => 'migrate-on-red',
provider => 'crm', provider => 'crm',
} }
}
cs_location { "clone_sysinfo-on-${::fqdn}": cs_rsc_location { "sysinfo-on-${::fqdn}":
primitive => 'clone_sysinfo', primitive => "sysinfo_${::fqdn}",
node_name => $::fqdn, node_name => $::fqdn,
score => 'INFINITY', 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 # load the mounted filesystems from our custom fact, remove boot
$mount_points = delete(split($::mounts, ','), '/boot') $mount_points = delete(split($::mounts, ','), '/boot')
$primary_controller = hiera('primary_controller')
$disks = hiera('corosync_disks', $mount_points) $disks = hiera('corosync_disks', $mount_points)
$min_disk_free = hiera('corosync_min_disk_space', '100M') $min_disk_free = hiera('corosync_min_disk_space', '100M')
$disk_unit = hiera('corosync_disk_unit', 'M') $disk_unit = hiera('corosync_disk_unit', 'M')
$monitor_interval = hiera('corosync_disk_monitor_interval', '30s') $monitor_interval = hiera('corosync_disk_monitor_interval', '30s')
class { 'cluster::sysinfo': class { 'cluster::sysinfo':
primary_controller => $primary_controller,
disks => $disks, disks => $disks,
min_disk_free => $min_disk_free, min_disk_free => $min_disk_free,
disk_unit => $disk_unit, disk_unit => $disk_unit,

View File

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