Add fence_crosslink support

This adds support for the newly introduced fence_crosslink
two-node fence agents pushed upstream:
https://github.com/ClusterLabs/fence-agents/pull/360

Change-Id: I3a9b852da78426ae45d99987022b630d833a84dc
This commit is contained in:
Michele Baldessari 2020-11-30 11:54:26 +01:00
parent 40d91a06a0
commit 2f4b6fafcb
3 changed files with 344 additions and 0 deletions

View File

@ -0,0 +1,109 @@
<?xml version="1.0" ?>
<resource-agent name="fence_crosslink" shortdesc="Fence agent for cross-link two-node clusters" >
<longdesc>This agent helps two-node clusters to tackle the situation where one node lost power, cannot be fenced by telling pacemaker that if the node is not reachable over the crosslink cable, we can assume it is dead</longdesc>
<vendor-url></vendor-url>
<parameters>
<parameter name="action" unique="0" required="1">
<getopt mixed="-o, --action=[action]" />
<content type="string" default="reboot" />
<shortdesc lang="en">Fencing action</shortdesc>
</parameter>
<parameter name="crosscableip" unique="0" required="1">
<getopt mixed="-a, --crosscableip=[IP]" />
<content type="string" />
<shortdesc lang="en">Cross-cable IP</shortdesc>
</parameter>
<parameter name="plug" unique="0" required="1" obsoletes="port">
<getopt mixed="-n, --plug=[id]" />
<content type="string" />
<shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
</parameter>
<parameter name="port" unique="0" required="1" deprecated="1">
<getopt mixed="-n, --plug=[id]" />
<content type="string" />
<shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
</parameter>
<parameter name="timeout" unique="0" required="0">
<getopt mixed="-T, --timeout=[seconds]" />
<content type="string" default="5" />
<shortdesc lang="en">No ICMP reply in 5 seconds -> Node is considered dead</shortdesc>
</parameter>
<parameter name="quiet" unique="0" required="0">
<getopt mixed="-q, --quiet" />
<content type="boolean" />
<shortdesc lang="en">Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog.</shortdesc>
</parameter>
<parameter name="verbose" unique="0" required="0">
<getopt mixed="-v, --verbose" />
<content type="boolean" />
<shortdesc lang="en">Verbose mode</shortdesc>
</parameter>
<parameter name="debug" unique="0" required="0" deprecated="1">
<getopt mixed="-D, --debug-file=[debugfile]" />
<content type="string" />
<shortdesc lang="en">Write debug information to given file</shortdesc>
</parameter>
<parameter name="debug_file" unique="0" required="0" obsoletes="debug">
<getopt mixed="-D, --debug-file=[debugfile]" />
<content type="string" />
<shortdesc lang="en">Write debug information to given file</shortdesc>
</parameter>
<parameter name="version" unique="0" required="0">
<getopt mixed="-V, --version" />
<content type="boolean" />
<shortdesc lang="en">Display version information and exit</shortdesc>
</parameter>
<parameter name="help" unique="0" required="0">
<getopt mixed="-h, --help" />
<content type="boolean" />
<shortdesc lang="en">Display help and exit</shortdesc>
</parameter>
<parameter name="separator" unique="0" required="0">
<getopt mixed="-C, --separator=[char]" />
<content type="string" default="," />
<shortdesc lang="en">Separator for CSV created by 'list' operation</shortdesc>
</parameter>
<parameter name="delay" unique="0" required="0">
<getopt mixed="--delay=[seconds]" />
<content type="second" default="0" />
<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
</parameter>
<parameter name="login_timeout" unique="0" required="0">
<getopt mixed="--login-timeout=[seconds]" />
<content type="second" default="5" />
<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
</parameter>
<parameter name="power_timeout" unique="0" required="0">
<getopt mixed="--power-timeout=[seconds]" />
<content type="second" default="20" />
<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
</parameter>
<parameter name="power_wait" unique="0" required="0">
<getopt mixed="--power-wait=[seconds]" />
<content type="second" default="0" />
<shortdesc lang="en">Wait X seconds after issuing ON/OFF</shortdesc>
</parameter>
<parameter name="shell_timeout" unique="0" required="0">
<getopt mixed="--shell-timeout=[seconds]" />
<content type="second" default="3" />
<shortdesc lang="en">Wait X seconds for cmd prompt after issuing command</shortdesc>
</parameter>
<parameter name="retry_on" unique="0" required="0">
<getopt mixed="--retry-on=[attempts]" />
<content type="integer" default="1" />
<shortdesc lang="en">Count of attempts to retry power on</shortdesc>
</parameter>
</parameters>
<actions>
<action name="on" automatic="0"/>
<action name="off" />
<action name="reboot" />
<action name="status" />
<action name="list" />
<action name="list-status" />
<action name="monitor" />
<action name="metadata" />
<action name="manpage" />
<action name="validate-all" />
</actions>
</resource-agent>

View File

@ -9,6 +9,7 @@ cmd_pkg_map=(
"fence_cisco_mds:fence-agents-cisco-mds"
"fence_cisco_ucs:fence-agents-cisco-ucs"
"fence_compute:fence-agents-compute"
"fence_crosslink:None"
"fence_drac5:fence-agents-drac5"
"fence_eaton_snmp:fence-agents-eaton-snmp"
"fence_eps:fence-agents-eps"

View File

@ -0,0 +1,234 @@
# == Define: pacemaker::stonith::fence_crosslink
#
# Module for managing Stonith for fence_crosslink.
#
# WARNING: Generated by "rake generate_stonith", manual changes will
# be lost.
#
# === Parameters
#
# [*action*]
# Fencing action
#
# [*crosscableip*]
# Cross-cable IP
#
# [*plug*]
# Physical plug number on device, UUID or identification of machine
#
# [*port*]
# Physical plug number on device, UUID or identification of machine
#
# [*timeout*]
# No ICMP reply in 5 seconds -> Node is considered dead
#
# [*quiet*]
# Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog.
#
# [*verbose*]
# Verbose mode
#
# [*debug*]
# Write debug information to given file
#
# [*debug_file*]
# Write debug information to given file
#
# [*separator*]
# Separator for CSV created by 'list' operation
#
# [*delay*]
# Wait X seconds before fencing is started
#
# [*login_timeout*]
# Wait X seconds for cmd prompt after login
#
# [*power_timeout*]
# Test X seconds for status change after ON/OFF
#
# [*power_wait*]
# Wait X seconds after issuing ON/OFF
#
# [*shell_timeout*]
# Wait X seconds for cmd prompt after issuing command
#
# [*retry_on*]
# Count of attempts to retry power on
#
# [*interval*]
# Interval between tries.
#
# [*ensure*]
# The desired state of the resource.
#
# [*tries*]
# The number of tries.
#
# [*try_sleep*]
# Time to sleep between tries.
#
# [*pcmk_host_list*]
# List of Pacemaker hosts.
#
# [*meta_attr*]
# (optional) String of meta attributes
# Defaults to undef
#
# [*deep_compare*]
# Enable deep comparing of resources and bundles
# When set to true a resource will be compared in full (options, meta parameters,..)
# to the existing one and in case of difference it will be repushed to the CIB
# Defaults to false
#
# [*update_settle_secs*]
# When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to 600 (seconds)
#
# === Dependencies
# None
#
# === Authors
#
# Generated by rake generate_stonith task.
#
# === Copyright
#
# Copyright (C) 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
define pacemaker::stonith::fence_crosslink (
$action = undef,
$crosscableip = undef,
$plug = undef,
$port = undef,
$timeout = undef,
$quiet = undef,
$verbose = undef,
$debug = undef,
$debug_file = undef,
$separator = undef,
$delay = undef,
$login_timeout = undef,
$power_timeout = undef,
$power_wait = undef,
$shell_timeout = undef,
$retry_on = undef,
$meta_attr = undef,
$interval = '60s',
$ensure = present,
$pcmk_host_list = undef,
$tries = undef,
$try_sleep = undef,
$deep_compare = false,
$update_settle_secs = 600,
) {
$action_chunk = $action ? {
undef => '',
default => "action=\"${action}\"",
}
$crosscableip_chunk = $crosscableip ? {
undef => '',
default => "crosscableip=\"${crosscableip}\"",
}
$plug_chunk = $plug ? {
undef => '',
default => "plug=\"${plug}\"",
}
$port_chunk = $port ? {
undef => '',
default => "port=\"${port}\"",
}
$timeout_chunk = $timeout ? {
undef => '',
default => "timeout=\"${timeout}\"",
}
$quiet_chunk = $quiet ? {
undef => '',
default => "quiet=\"${quiet}\"",
}
$verbose_chunk = $verbose ? {
undef => '',
default => "verbose=\"${verbose}\"",
}
$debug_chunk = $debug ? {
undef => '',
default => "debug=\"${debug}\"",
}
$debug_file_chunk = $debug_file ? {
undef => '',
default => "debug_file=\"${debug_file}\"",
}
$separator_chunk = $separator ? {
undef => '',
default => "separator=\"${separator}\"",
}
$delay_chunk = $delay ? {
undef => '',
default => "delay=\"${delay}\"",
}
$login_timeout_chunk = $login_timeout ? {
undef => '',
default => "login_timeout=\"${login_timeout}\"",
}
$power_timeout_chunk = $power_timeout ? {
undef => '',
default => "power_timeout=\"${power_timeout}\"",
}
$power_wait_chunk = $power_wait ? {
undef => '',
default => "power_wait=\"${power_wait}\"",
}
$shell_timeout_chunk = $shell_timeout ? {
undef => '',
default => "shell_timeout=\"${shell_timeout}\"",
}
$retry_on_chunk = $retry_on ? {
undef => '',
default => "retry_on=\"${retry_on}\"",
}
$pcmk_host_value_chunk = $pcmk_host_list ? {
undef => '$(/usr/sbin/crm_node -n)',
default => $pcmk_host_list,
}
$meta_attr_value_chunk = $meta_attr ? {
undef => '',
default => "meta ${meta_attr}",
}
# $title can be a mac address, remove the colons for pcmk resource name
$safe_title = regsubst($title, ':', '', 'G')
Exec<| title == 'wait-for-settle' |> -> Pcmk_stonith<||>
$param_string = "${action_chunk} ${crosscableip_chunk} ${plug_chunk} ${port_chunk} ${timeout_chunk} ${quiet_chunk} ${verbose_chunk} ${debug_chunk} ${debug_file_chunk} ${separator_chunk} ${delay_chunk} ${login_timeout_chunk} ${power_timeout_chunk} ${power_wait_chunk} ${shell_timeout_chunk} ${retry_on_chunk} op monitor interval=${interval} ${meta_attr_value_chunk}"
pcmk_stonith { "stonith-fence_crosslink-${safe_title}":
ensure => $ensure,
stonith_type => 'fence_crosslink',
pcmk_host_list => $pcmk_host_value_chunk,
pcs_param_string => $param_string,
tries => $tries,
try_sleep => $try_sleep,
deep_compare => $deep_compare,
update_settle_secs => $update_settle_secs,
}
}