3 # Lustre - Heartbeat R1 Resource Agent for the Lustre file system
5 # Usage: Lustre <resource-name> start|stop|status
6 # where <resource-name> has the form "<hostname>-targets"
11 if [ -e /etc/logd.cf ] && [ -x /usr/sbin/ha_logger ]; then
12 /usr/sbin/ha_logger -t heartbeat "Lustre: $*"
13 elif [ -x /usr/bin/logger ]; then
14 /usr/bin/logger -t heartbeat "Lustre: $*"
15 elif [ -x /bin/logger ]; then
16 /bin/logger -t heartbeat "Lustre: $*"
30 die "wrong number of arguments: $*"
32 if ! [ "$2" == "start" -o "$2" == "stop" -o "$2" == "status" ]; then
33 die "bad action arg[2]: $*"
36 if ! [ -x /usr/sbin/ldev ]; then
37 die "/usr/sbin/ldev is missing or not executable"
39 if ! [ -x /etc/init.d/lustre ]; then
40 die "/etc/init.d/lustre is missing or not executable"
44 if [ "`uname -n`-targets" == "$1" ]; then
46 elif [ "`/usr/sbin/ldev -p`-targets" == "$1" ]; then
49 die "bad service arg[1]: $*"
52 # Until multi-mount protect is implemented for ZFS we allow heartbeat to
53 # force import a pool. This is required because ZFS will not allow you to
54 # import a pool on a new host unless you have cleanly exported it.
55 export ZPOOL_IMPORT_ARGS='-f'
57 # N.B. If status action reports "running", this must pass through to
58 # heartbeat unmodified. Otherwise, stdout/stderr is discarded by heartbeat,
59 # so if we want to log diagnostic output from init scripts, we have to
62 warn /etc/init.d/lustre $action $service
64 tmpout=`mktemp` || die "mktemp failed"
65 /etc/init.d/lustre $action $service >$tmpout
67 cat $tmpout | while read line; do