4
# Dummy OCF RA. Does nothing but wait a few seconds, can be
5
# configured to fail occassionally.
7
# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
10
# This program is free software; you can redistribute it and/or modify
11
# it under the terms of version 2 of the GNU General Public License as
12
# published by the Free Software Foundation.
14
# This program is distributed in the hope that it would be useful, but
15
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
# Further, this software is distributed without any warranty that it is
19
# free of the rightful claim of any third person regarding infringement
20
# or the like. Any license provided herein, whether implied or
21
# otherwise, applies only to this software file. Patent licenses, if
22
# any, provided herein do not apply to combinations of this program with
23
# other software, or any other product whatsoever.
25
# You should have received a copy of the GNU General Public License
26
# along with this program; if not, write the Free Software Foundation,
27
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
30
#######################################################################
33
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
34
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
36
#######################################################################
41
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
42
<resource-agent name="Dummy" version="0.9">
43
<version>1.0</version>
46
This is a Dummy Resource Agent. It does absolutely nothing except
47
keep track of whether its running or not.
48
Its purpose in life is for testing and to serve as a template for RA writers.
50
NB: Please pay attention to the timeouts specified in the actions
51
section below. They should be meaningful for the kind of resource
52
the agent manages. They should be the minimum advised timeouts,
53
but they shouldn't/cannot cover _all_ possible resource
54
instances. So, try to be neither overly generous nor too stingy,
55
but moderate. The minimum timeouts should never be below 10 seconds.
57
<shortdesc lang="en">Example stateless resource agent</shortdesc>
60
<parameter name="state" unique="1">
62
Location to store the resource state in.
64
<shortdesc lang="en">State file</shortdesc>
65
<content type="string" default="${HA_RSCTMP}/Dummy-${OCF_RESOURCE_INSTANCE}.state" />
68
<parameter name="fake" unique="0">
70
Fake attribute that can be changed to cause a reload
72
<shortdesc lang="en">Fake attribute that can be changed to cause a reload</shortdesc>
73
<content type="string" default="dummy" />
79
<action name="start" timeout="20" />
80
<action name="stop" timeout="20" />
81
<action name="monitor" timeout="20" interval="10" depth="0" />
82
<action name="reload" timeout="20" />
83
<action name="migrate_to" timeout="20" />
84
<action name="migrate_from" timeout="20" />
85
<action name="meta-data" timeout="5" />
86
<action name="validate-all" timeout="20" />
92
#######################################################################
96
usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data}
98
Expects to have a fully populated OCF RA-compliant environment set.
104
if [ $? = $OCF_SUCCESS ]; then
107
touch ${OCF_RESKEY_state}
112
if [ $? = $OCF_SUCCESS ]; then
113
rm ${OCF_RESKEY_state}
119
# Monitor _MUST!_ differentiate correctly between running
120
# (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING).
121
# That is THREE states, not just yes/no.
123
if [ -f ${OCF_RESKEY_state} ]; then
127
return $OCF_ERR_GENERIC
129
return $OCF_NOT_RUNNING
134
# Is the state directory writable?
135
state_dir=`dirname "$OCF_RESKEY_state"`
136
touch "$state_dir/$$"
145
: ${OCF_RESKEY_state=${HA_RSCTMP}/Dummy-${OCF_RESOURCE_INSTANCE}.state}
146
: ${OCF_RESKEY_fake="dummy"}
148
case $__OCF_ACTION in
154
monitor) dummy_monitor;;
155
migrate_to) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_target}."
158
migrate_from) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} from ${OCF_RESKEY_CRM_meta_migrate_source}."
161
reload) ocf_log info "Reloading ${OCF_RESOURCE_INSTANCE} ..."
163
validate-all) dummy_validate;;
164
usage|help) dummy_usage
168
exit $OCF_ERR_UNIMPLEMENTED
172
ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"