From 93b0ade95b63f682140893c333f826868585ab2b Mon Sep 17 00:00:00 2001 From: Fabio M. Di Nitto Date: Oct 08 2012 16:27:02 +0000 Subject: fence_sanlock: improve action_on error checking and report Signed-off-by: Fabio M. Di Nitto --- diff --git a/fence_sanlock/fence_sanlock.in b/fence_sanlock/fence_sanlock.in index 1140880..1892882 100755 --- a/fence_sanlock/fence_sanlock.in +++ b/fence_sanlock/fence_sanlock.in @@ -200,11 +200,30 @@ action_on() { # wait for fence_sanlockd to acquire the local lease; # it can take minutes, and we can't allow fence_tool join # until this is complete + initdone="" + while [ -z "$initdone" ]; do + + # make sure sanlockd is alive while bootstrap + # is in progress + clientstatus="$(sanlock client status)" + [ "$?" != 0 ] && { + echo "Error communicating with sanlockd" + return 1 + } + + + # make sure fence_sanlockd is alive while bootstrap + # is in progress + [ -z "$(pidof fence_sanlockd)" ] && { + echo "fence_sanlockd is not running" + return 1 + } - while ! sanlock client status | grep -q fence:h$host_id:$path:$offset; do # FIXME: check that r is really done being acquired? # just appearing in output may not be enough + echo "$clientstatus" | grep -q fence:h$host_id:$path:$offset && initdone="yes" + sleep 1 done