This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: STABLE3 - cman init: fix cman startup issues


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
 ;;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]