[Linux-HA] Re: OCF version of drbd
Chun Tian (binghe)
binghe.lisp at gmail.com
Thu Mar 30 16:49:16 MST 2006
Hi,
Are you using this RA script comes with DRBD(I use debian's
drbd0.7-utils package)? (and maybe you change 'status' to 'monitor'?)
And did you mean that the RA which class="heartbeat" also support a
<operations> define?
Thanks.
#!/bin/bash
#
# This script is inteded to be used as resource script by heartbeat
#
# Jan 2003 by Philipp Reisner.
#
###
DEFAULTFILE="/etc/default/drbd"
DRBDADM="/sbin/drbdadm"
if [ -f $DEFAULTFILE ]; then
. $DEFAULTFILE
fi
if [ "$#" -eq 2 ]; then
RES="$1"
CMD="$2"
else
RES="all"
CMD="$1"
fi
case "$CMD" in
start)
# try several times, in case heartbeat deadtime
# was smaller than drbd ping time
try=6
while true; do
$DRBDADM primary $RES && break
let "--try" || exit 20
sleep 1
done
;;
stop)
# exec, so the exit code of drbdadm propagates
exec $DRBDADM secondary $RES
;;
status)
if [ "$RES" = "all" ]; then
echo "A resource name is required for status inquiries."
exit 10
fi
ST=$( $DRBDADM state $RES 2>&1 )
STATE=${ST%/*}
if [ "$STATE" = "Primary" ]; then
echo "running"
elif [ "$STATE" = "Secondary" ]; then
echo "stopped"
else
echo "$ST"
fi
;;
*)
echo "Usage: drbddisk [resource] {start|stop|status}"
exit 1
;;
esac
exit 0
Scott Simpson wrote:
> I gave up on the OCF version of that script and used the heartbeat version
> "drbddisk" and it seemed to work fine. My cib.xml has
>
> <primitive class="heartbeat" id="drbd" provider="heartbeat" type="drbddisk">
> <operations>
> <op id="drbd_monitor" interval="120s" name="monitor" timeout="60s"/>
> </operations>
> <instance_attributes>
> <attributes>
> <nvpair id="drbd_resource_name" name="1" value="drbd0"/>
> </attributes>
> </instance_attributes>
> </primitive>
>
> in it. Also, I added
>
> /sbin/modprobe drbd
> sleep 10
> /sbin/drbadm adjust all
>
> to /etc/rc.local. Everything seems to work fine.
>
>
>
> _______________________________________________
> Linux-HA mailing list
> Linux-HA at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>
More information about the Linux-HA
mailing list