3 # lhbadm - handle some common heartbeat/lustre failover ops
5 PATH=/sbin:/usr/sbin:/usr/bin:$PATH:/usr/lib64/heartbeat:/usr/lib/heartbeat
22 echo "Usage: $prog status|lstatus|failback|failover"
23 echo " status - print one-line heartbeat-lustre status"
24 echo " failover - fail all my active resources over to partner"
25 echo " failback - fail my normal resources back"
37 for label in $(ldev -l); do
39 if [ "$(service lustre status $label)" == "running" ]; then
40 lcount=$((lcount + 1))
43 for label in $(ldev -f); do
45 if [ "$(service lustre status $label)" == "running" ]; then
46 fcount=$((fcount + 1))
50 if [ $(($lcount + $fcount)) == 0 ]; then
52 elif [ $lcount == $ltot -a $fcount == 0 ]; then
54 elif [ $lcount == 0 -a $fcount == $ftot ]; then
56 elif [ $lcount == $ltot -a $fcount == $ftot ]; then
68 rstat=$(cl_status rscstatus) || die "cl_status rscstatus failed"
69 fstat=$(service lustre status)
71 if [ "$fstat" == "running" ]; then
78 wait_for_transition ()
81 state=$(cl_status rscstatus) || die "cl_status rscstatus failed"
82 [ "$state" == "transition" ] || break
90 [ "$(id -un)" == "root" ] || die "failover requires root privileges"
91 [ $# -gt 0 ] || die "please include a descriptive reason for the logs"
94 logger -s -t Lustre-ha -p user.err "failover start, status=$s, reason: $*"
96 hb_standby all 2>/dev/null 1>&2 || die "hb_standby all failed"
100 logger -s -t Lustre-ha -p user.err "failover complete, status=$s"
107 [ "$(id -un)" == "root" ] || die "failback requires root privileges"
108 [ $# -gt 0 ] || die "please include a descriptive reason for the logs"
111 logger -s -t Lustre-ha -p user.err "failback start, status=$s, reason: $*"
113 hb_takeover local || die "hb_takeover local failed"
117 logger -s -t Lustre-ha -p user.err "failover complete, status=$s"
126 [ -x /usr/bin/cl_status ] || die "Heartbeat is not installed"
127 hstat=$(cl_status hbstatus) || die "$hstat"
132 failback) shift; failback $*;;
133 failover) shift; failover $*;;
137 # vi: ts=4 sw=4 expandtab