public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - cman init: fix cman startup issues
Date: Thu, 20 Aug 2009 07:35:00 -0000	[thread overview]
Message-ID: <20090820073520.7E4A712036A@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=6c4b0ee0886d6105fe8e5ead2db4e192cbc9e20e
Commit:        6c4b0ee0886d6105fe8e5ead2db4e192cbc9e20e
Parent:        cd7204afe474d03067e18f7d6786410893620e07
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Thu Aug 20 09:31:53 2009 +0200
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Thu Aug 20 09:31:53 2009 +0200

cman init: fix cman startup issues

with recent changes to cman/corosync to better report errors
on startup, we accidentally fixed "too much" logging with debug="on".

those changes introduced a bunch of problems with file descriptors
in the init script.

change the init script to startup cman in such a way that it
won't make a mess of fd's.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/init.d/cman.in |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index e753f7c..050bfe7 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -169,7 +169,7 @@ ok() {
 }
 
 nok() {
-	echo $errmsg
+	echo "$errmsg"
 	failure
 	echo
 	exit 1
@@ -479,10 +479,30 @@ set_networking_params()
 
 start_cman()
 {
-	if ! cman_running && cman_checkconfig; then
-		errmsg=$( cman_tool -t $CMAN_CLUSTER_TIMEOUT -w join \
-			$cman_join_opts 2>&1 ) || return 1
+	cman_running && return 0
+	cman_checkconfig || return 1
+
+	tmpfile=$(mktemp -t cmanstartup.XXXXXXXXXX)
+	if [ -z "$tmpfile" ]; then
+		errmsg="Unable to create temporary file"
+		return 1
+	fi
+
+	cman_tool -t $CMAN_CLUSTER_TIMEOUT -w join $cman_join_opts > $tmpfile 2>&1 &
+
+	while status cman_tool >/dev/null 2>&1; do
+		sleep 0.2
+	done
+
+	if ! cman_running; then
+		errmsg="$(cat $tmpfile)"
+		ret=1
+	else
+		ret=0
 	fi
+
+	rm -f $tmpfile
+	return $ret
 }
 
 wait_for_quorum()
@@ -840,7 +860,7 @@ status)
 			echo "cluster is running."
 		fi
 	else
-		echo $errmsg
+		echo "$errmsg"
 		rtrn=1
 	fi
 ;;


                 reply	other threads:[~2009-08-20  7:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090820073520.7E4A712036A@lists.fedorahosted.org \
    --to=fabbione@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).