From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18249 invoked by alias); 17 Mar 2009 19:26:39 -0000 Received: (qmail 18243 invoked by alias); 17 Mar 2009 19:26:38 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: master - fence_tool, init.d/cman: fix wait/retry options To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c3bd2524e7a5de95a14cd961116764bb8621c4bf X-Git-Newrev: b0d82b0f0a3bf06189e6664d273f885a971c3817 From: David Teigland Message-Id: <20090317192612.90A1E120150@lists.fedorahosted.org> Date: Tue, 17 Mar 2009 19:26:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00807.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=b0d82b0f0a3bf06189e6664d273f885a971c3817 Commit: b0d82b0f0a3bf06189e6664d273f885a971c3817 Parent: c3bd2524e7a5de95a14cd961116764bb8621c4bf Author: David Teigland AuthorDate: Tue Mar 17 14:21:58 2009 -0500 Committer: David Teigland CommitterDate: Tue Mar 17 14:21:58 2009 -0500 fence_tool, init.d/cman: fix wait/retry options Bring some sanity to the fence_tool ad hoc wait/retry options, which are used by init.d/cman. At a high level we want: . fence_tool join to fail right away, with an error, if cman or fenced fail or aren't running . fence_tool join to exit with 0 if the join succeeds and with 1 if it fails . do these things properly even when fenced is slow starting up, or in processing the join Signed-off-by: David Teigland --- cman/init.d/cman.in | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in index cf3550e..8b4c26a 100644 --- a/cman/init.d/cman.in +++ b/cman/init.d/cman.in @@ -92,12 +92,11 @@ fi # are found in @NOTIFYDDIR@ [ -z "$CMAN_NOTIFYD_START" ] && CMAN_NOTIFYD_START=conditional -# FENCED_START_TIMEOUT -- amount of time to wait for starting fenced -# before giving up. If FENCED_START_TIMEOUT is positive, then we will -# wait FENCED_START_TIMEOUT seconds before giving up and failing when -# fenced does not start. If FENCED_START_TIMEOUT is zero, then -# wait indefinately for fenced to start. -[ -z "$FENCED_START_TIMEOUT" ] && FENCED_START_TIMEOUT=300 +# FENCE_JOIN_TIMEOUT -- seconds to wait for fence domain join to +# complete. If the join hasn't completed in this time, fence_tool join +# exits with an error, and this script exits with an error. To wait +# indefinitely set the value to -1. +[ -z "$FENCE_JOIN_TIMEOUT" ] && FENCE_JOIN_TIMEOUT=20 # NET_RMEM_DEFAULT -- minimum value for rmem_default. If this is set # higher elsewhere it will not be reduced here. @@ -294,11 +293,11 @@ start_fence() @SBINDIR@/cman_tool status | grep Flags | grep 2node > /dev/null 2>&1 if [ $? -ne 0 ] then - errmsg=$( @SBINDIR@/fence_tool -w -t $FENCED_START_TIMEOUT join \ + errmsg=$( @SBINDIR@/fence_tool join -w $FENCE_JOIN_TIMEOUT \ > /dev/null 2>&1 ) || return 1 else - errmsg=$( @SBINDIR@/fence_tool -w -t $FENCED_START_TIMEOUT \ - -m $FENCED_MEMBER_DELAY join \ + errmsg=$( @SBINDIR@/fence_tool join -w $FENCE_JOIN_TIMEOUT \ + -m $FENCED_MEMBER_DELAY join \ > /dev/null 2>&1 ) || return 1 fi return 0 @@ -582,9 +581,8 @@ stop_fence() { if pidof fenced > /dev/null 2>&1 then - @SBINDIR@/fence_tool -w leave > /dev/null 2>&1 + @SBINDIR@/fence_tool leave -w 10 > /dev/null 2>&1 rtrn=$? - sleep 1 # A bit of time for fenced to exit return $rtrn fi return 0 # all ok