/usr/lib/ocf/resource.d/heartbeat/EvmsSCC is in resource-agents 1:3.9.7-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | #!/bin/sh
#
# Support: linux-ha@lists.linux-ha.org
# License: GNU General Public License (GPL)
#
# EvmsSCC
# Description: Runs evms_activate in a heartbeat cluster to activate a
# EVMS shared cluster container in the cluster.
# Original Author: Jo De Baer (jdebaer@novell.com)
# Original Release: 06 Nov 2006
#
# usage: ./EvmsSCC {start|stop|status|monitor|meta-data}
#
# The goal of this resource agent is to provoke the creation of device file
# in /dev/emvs which correspond to EVMS2 volumes that reside in a EVMS2 shared
# cluster container. As such it should be run as a clone resource in the
# cluster. Logic inside the resource agent will make sure that "evms_activate"
# is run on only one node in the cluster, both at cluster startup time as well
# as when a node joins the cluster.
#
# Typically, resources that need to mount EVMS2 volumes should run after this
# resource agent has finished it's run. As such those resources should be made
# "dependent" on this resource agent by the cluster administrator. An example
# of resources that should depend on this resource agent are Filesystem resource
# agent that mount OCFS2 volumes that reside on EVMS2 volumes in a shared
# EVMS2 cluster container.
#
# For this resource agent to do it's job correctly, evmsd must be running on
# the node where the agent is started. Usually evmsd is started by the cluster
# software via a respawn statement in /etc/ha.d/ha.cf. If you encounter timing
# issues where evmsd is not yet started but where the cluster already starts
# the EvmsSCC clone, then you should comment out the evmsd respawn statement
# in /etc/ha.d/ha.cf and start evmsd on each node in the cluster via a separate
# clone resource agent. The EvmsSCC resource agent cloneset should then be made
# dependent to this evmsd cloneset. This will guarantee that emvsd is running
# before EvmsSCC is started, on each node in the cluster.
#
#######################################################################
# Initialization:
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
#######################################################################
# Utilities used by this script
CUT=cut
EVMSACTIVATE=evms_activate
usage() {
cat <<-EOT
usage: $0 {start|stop|status|monitor|meta-data}
EOT
}
meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="EvmsSCC">
<version>1.0</version>
<longdesc lang="en">
Deprecation warning: EVMS is no longer actively maintained and should not be used. This agent is deprecated and may be removed from a future release. --
Resource script for EVMS shared cluster container. It runs evms_activate on one node in the cluster.
</longdesc>
<shortdesc lang="en">Manages EVMS Shared Cluster Containers (SCCs) (deprecated)</shortdesc>
<parameters>
<parameter name="ignore_deprecation">
<longdesc lang="en">
If set to true, suppresses the deprecation warning for this agent.
</longdesc>
<shortdesc lang="en">Suppress deprecation warning</shortdesc>
<content type="boolean" default="false" />
</parameter>
</parameters>
<actions>
<action name="start" timeout="60" />
<action name="stop" timeout="60" />
<action name="notify" timeout="60" />
<action name="status" depth="0" timeout="10" interval="10" />
<action name="monitor" depth="0" timeout="10" interval="10" />
<action name="meta-data" timeout="5" />
</actions>
</resource-agent>
END
}
EvmsSCC_status()
{
# At the moment we don't support monitoring EVMS activations. We just return "not running" to cope with the pre-start monitor call.
return $OCF_NOT_RUNNING
}
EvmsSCC_notify()
{
local n_type="$OCF_RESKEY_CRM_meta_notify_type"
local n_op="$OCF_RESKEY_CRM_meta_notify_operation"
local n_active="$OCF_RESKEY_CRM_meta_notify_active_uname"
local n_stop="$OCF_RESKEY_CRM_meta_notify_stop_uname"
local n_start="$OCF_RESKEY_CRM_meta_notify_start_uname"
case "$n_type" in
pre)
case "$n_op" in
start) ocf_log debug "EvmsSCC: Notify: Starting node(s): $n_start."
EvmsSCC_start_notify_common
;;
esac
;;
esac
return $OCF_SUCCESS
}
EvmsSCC_start()
{
local n_type="$OCF_RESKEY_CRM_meta_notify_type"
local n_op="$OCF_RESKEY_CRM_meta_notify_operation"
local n_active="$OCF_RESKEY_CRM_meta_notify_active_uname"
local n_stop="$OCF_RESKEY_CRM_meta_notify_stop_uname"
local n_start="$OCF_RESKEY_CRM_meta_notify_start_uname"
ocf_log debug "EvmsSCC: Start: starting node(s): $n_start."
EvmsSCC_start_notify_common
return $OCF_SUCCESS
}
EvmsSCC_stop()
{
return $OCF_SUCCESS
}
EvmsSCC_start_notify_common()
{
local n_myself=${HA_CURHOST:-$(uname -n | tr A-Z a-z)}
ocf_log debug "EvmsSCC: Start_Notify: I am node $n_myself."
n_active="$n_active $n_start"
case " $n_active " in
*" $n_myself "*) ;;
*) ocf_log err "EvmsSCC: $n_myself (local) not on active list!"
return $OCF_ERR_GENERIC
;;
esac
#pick the first node from the starting list
#when the cluster boots this will be one of the many booting nodes
#when a node later joins the cluster, this will be the joining node
local n_first=$(echo $n_start | cut -d ' ' -f 1)
ocf_log debug "EvmsSCC: Start_Notify: First node in starting list is $n_first."
if [ "$n_myself" = "$n_first" ] ; then
ocf_log debug "EvmsSCC: Start_Notify: I am running ${EVMSACTIVATE}."
while true ; do
if ! ${EVMSACTIVATE} -q 2> /dev/null ; then
SLEEP_TIME=$(($(ocf_maybe_random) % 40))
ocf_log info "EvmsSCC: Evms call failed - sleeping for $SLEEP_TIME seconds and then trying again."
sleep $SLEEP_TIME
else
break
fi
done
fi
return $OCF_SUCCESS
}
# Check the arguments passed to this script
if
[ $# -ne 1 ]
then
usage
exit $OCF_ERR_ARGS
fi
OP=$1
case $OP in
meta-data) meta_data
exit $OCF_SUCCESS
;;
usage) usage
exit $OCF_SUCCESS
;;
esac
# Be obnoxious, log deprecation warning on every invocation (unless
# suppressed by resource configuration).
ocf_deprecated
check_binary $CUT
check_binary $EVMSACTIVATE
case $OP in
start) EvmsSCC_start
;;
notify) EvmsSCC_notify
;;
stop) EvmsSCC_stop
;;
status|monitor) EvmsSCC_status
;;
*) usage
exit $OCF_ERR_UNIMPLEMENTED
;;
esac
exit $?
|