3
# Support: linux-ha@lists.linux-ha.org
4
# License: GNU General Public License (GPL)
7
# Description: Runs evms_activate in a heartbeat cluster to activate a
8
# EVMS shared cluster container in the cluster.
9
# Original Author: Jo De Baer (jdebaer@novell.com)
10
# Original Release: 06 Nov 2006
12
# usage: ./EvmsSCC {start|stop|status|monitor|meta-data}
14
# The goal of this resource agent is to provoke the creation of device file
15
# in /dev/emvs which correspond to EVMS2 volumes that reside in a EVMS2 shared
16
# cluster container. As such it should be run as a clone resource in the
17
# cluster. Logic inside the resource agent will make sure that "evms_activate"
18
# is run on only one node in the cluster, both at cluster startup time as well
19
# as when a node joins the cluster.
21
# Typically, resources that need to mount EVMS2 volumes should run after this
22
# resource agent has finished it's run. As such those resources should be made
23
# "dependent" on this resource agent by the cluster administrator. An example
24
# of resources that should depend on this resource agent are Filesystem resource
25
# agent that mount OCFS2 volumes that reside on EVMS2 volumes in a shared
26
# EVMS2 cluster container.
28
# For this resource agent to do it's job correctly, evmsd must be running on
29
# the node where the agent is started. Usually evmsd is started by the cluster
30
# software via a respawn statement in /etc/ha.d/ha.cf. If you encounter timing
31
# issues where evmsd is not yet started but where the cluster already starts
32
# the EvmsSCC clone, then you should comment out the evmsd respawn statement
33
# in /etc/ha.d/ha.cf and start evmsd on each node in the cluster via a separate
34
# clone resource agent. The EvmsSCC resource agent cloneset should then be made
35
# dependent to this evmsd cloneset. This will guarantee that emvsd is running
36
# before EvmsSCC is started, on each node in the cluster.
39
#######################################################################
42
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
43
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
45
#######################################################################
48
# Utilities used by this script
50
EVMSACTIVATE=evms_activate
54
usage: $0 {start|stop|status|monitor|meta-data}
61
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
62
<resource-agent name="EvmsSCC">
63
<version>1.0</version>
66
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. --
67
Resource script for EVMS shared cluster container. It runs evms_activate on one node in the cluster.
69
<shortdesc lang="en">Manages EVMS Shared Cluster Containers (SCCs) (deprecated)</shortdesc>
72
<parameter name="ignore_deprecation">
74
If set to true, suppresses the deprecation warning for this agent.
76
<shortdesc lang="en">Suppress deprecation warning</shortdesc>
77
<content type="boolean" default="false" />
82
<action name="start" timeout="60" />
83
<action name="stop" timeout="60" />
84
<action name="notify" timeout="60" />
85
<action name="status" depth="0" timeout="10" interval="10" />
86
<action name="monitor" depth="0" timeout="10" interval="10" />
87
<action name="meta-data" timeout="5" />
95
# At the moment we don't support monitoring EVMS activations. We just return "not running" to cope with the pre-start monitor call.
96
return $OCF_NOT_RUNNING
101
local n_type="$OCF_RESKEY_CRM_meta_notify_type"
102
local n_op="$OCF_RESKEY_CRM_meta_notify_operation"
103
local n_active="$OCF_RESKEY_CRM_meta_notify_active_uname"
104
local n_stop="$OCF_RESKEY_CRM_meta_notify_stop_uname"
105
local n_start="$OCF_RESKEY_CRM_meta_notify_start_uname"
110
start) ocf_log debug "EvmsSCC: Notify: Starting node(s): $n_start."
111
EvmsSCC_start_notify_common
123
local n_type="$OCF_RESKEY_CRM_meta_notify_type"
124
local n_op="$OCF_RESKEY_CRM_meta_notify_operation"
125
local n_active="$OCF_RESKEY_CRM_meta_notify_active_uname"
126
local n_stop="$OCF_RESKEY_CRM_meta_notify_stop_uname"
127
local n_start="$OCF_RESKEY_CRM_meta_notify_start_uname"
129
ocf_log debug "EvmsSCC: Start: starting node(s): $n_start."
131
EvmsSCC_start_notify_common
141
EvmsSCC_start_notify_common()
143
local n_myself=${HA_CURHOST:-$(uname -n | tr A-Z a-z)}
144
ocf_log debug "EvmsSCC: Start_Notify: I am node $n_myself."
146
n_active="$n_active $n_start"
147
case " $n_active " in
149
*) ocf_log err "EvmsSCC: $n_myself (local) not on active list!"
150
return $OCF_ERR_GENERIC
154
#pick the first node from the starting list
155
#when the cluster boots this will be one of the many booting nodes
156
#when a node later joins the cluster, this will be the joining node
157
local n_first=$(echo $n_start | cut -d ' ' -f 1)
158
ocf_log debug "EvmsSCC: Start_Notify: First node in starting list is $n_first."
160
if [ "$n_myself" = "$n_first" ] ; then
161
ocf_log debug "EvmsSCC: Start_Notify: I am running evms_activate."
162
EVMS_OUTPUT="startvalue"
163
while [ -n "$EVMS_OUTPUT" ] ; do
164
EVMS_OUTPUT=`evms_activate 2>&1`
165
if [ -n "$EVMS_OUTPUT" ] ; then
166
SLEEP_TIME=$(($(ocf_maybe_random) % 40))
167
ocf_log info "EvmsSCC: Evms call failed - sleeping for $SLEEP_TIME seconds and then trying again."
179
# Check the arguments passed to this script
198
# Be obnoxious, log deprecation warning on every invocation (unless
199
# suppressed by resource configuration).
203
check_binary $EVMSACTIVATE
208
notify) EvmsSCC_notify
212
status|monitor) EvmsSCC_status
215
exit $OCF_ERR_UNIMPLEMENTED