Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Lars Ellenberg <lars.ellenberg@linbit.com>
To: drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] [DRBD-8.0 PATCH] Make heartbeat script conform to LSB spec
Date: Mon, 14 Jan 2008 09:21:56 +0100	[thread overview]
Message-ID: <20080114082156.GE5715@barkeeper1.linbit> (raw)
In-Reply-To: <342BAC0A5467384983B586A6B0B3767107C5AF55@EXNA.corp.stratus.com>

On Fri, Jan 11, 2008 at 10:14:50AM -0500, Graham, Simon wrote:
> The drbddisk script has a few places where it returns exit codes that don’t
> conform to the LSB spec when it could – this patch corrects the ones I’ve seen.

well, it is no lsb script, it is not intended to be,
and without proper support by drbdadm and drbdsetup,
it is probably not as easy as one might think to
actually make it lsb conform.

it is a "legacy heartbeat v1 resource agent" script.
so actually I see no point in making it conform to
some standard which does not apply.

but:

Content-Description: 0002-Make-heartbeat-script-conform-to-LSB-spec.patch
> From b56371785abc5f22698dcffe699e0434a88beab7 Mon Sep 17 00:00:00 2001
> From: Simon Graham <sgraham@anna.sn.stratus.com>
> Date: Fri, 21 Dec 2007 21:12:27 -0500
> Subject: [PATCH] Make heartbeat script conform to LSB spec
> 
> ---
>  scripts/drbddisk |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/drbddisk b/scripts/drbddisk
> index 7d001f5..53e02a0 100755
> --- a/scripts/drbddisk
> +++ b/scripts/drbddisk
> @@ -29,13 +29,15 @@ case "$CMD" in
>  	try=6
>  	while true; do
>  		$DRBDADM primary $RES && break
> -		let "--try" || exit 20
> +		let "--try" || exit 1

Ok. neither me nor heartbeat would care.

>  		sleep 1
>  	done
>  	;;
>      stop)
> -	# exec, so the exit code of drbdadm propagates
> -	exec $DRBDADM secondary $RES
> +	$DRBDADM secondary $RES
> +	if [ $? -eq 11 ]; then
> +	    exit 1
> +	fi

uh?
where does the 11 come from?
why handle only 11, and map everything else to 0?
what for exit codes != 0 and != 11?


>      status)
>  	if [ "$RES" = "all" ]; then
> @@ -46,10 +48,8 @@ case "$CMD" in
>  	STATE=${ST%/*}
>  	if [ "$STATE" = "Primary" ]; then
>  	    echo "running"
> -	elif [ "$STATE" = "Secondary" ]; then
> -	    echo "stopped"
>  	else
> -	    echo "$ST"
> +	    echo "stopped"

what about:
	STATE=${ST%/*}
+	case $STATE in
+		Primary)
+			echo "running (Primary)" ;;
+		Secondary|Unconfigured)
+			echo "stopped ($STATE)" ;;
+		"")
+			echo "stopped" ;;
+		*)
+			# unexpected. whatever...
+			echo "stopped ($ST)" ;;
+	esac


-- 
: Lars Ellenberg                            Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH      Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe    http://www.linbit.com :

      reply	other threads:[~2008-01-14  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 15:14 [Drbd-dev] [DRBD-8.0 PATCH] Make heartbeat script conform to LSB spec Graham, Simon
2008-01-14  8:21 ` Lars Ellenberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080114082156.GE5715@barkeeper1.linbit \
    --to=lars.ellenberg@linbit.com \
    --cc=drbd-dev@lists.linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox