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: move special checks where they belong
Date: Fri, 27 Mar 2009 19:07:00 -0000	[thread overview]
Message-ID: <20090327190631.4403812020C@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=baa58122d5fb7957c2955cb39ed32613a9edb664
Commit:        baa58122d5fb7957c2955cb39ed32613a9edb664
Parent:        f12fafcd7b7ce7803fdb20b5662646d909745c75
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Mar 25 15:06:30 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Mar 27 20:05:45 2009 +0100

cman init: move special checks where they belong

move all conditional starts within the functions that need them
and away from the main start procedure.

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

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index d2665d3..8cc224c 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -366,6 +366,11 @@ start_daemons()
 
 start_fence()
 {
+	if ! fence_join_enabled; then
+		echo -n "not required"
+		return 0
+	fi
+
 	if ! @SBINDIR@/cman_tool status | grep Flags | grep 2node > /dev/null 2>&1; then
         	errmsg=$( @SBINDIR@/fence_tool join -w $FENCE_JOIN_TIMEOUT \
 			> /dev/null 2>&1 ) || return 1
@@ -379,6 +384,11 @@ start_fence()
 
 start_fence_xvmd()
 {
+	if ! fence_xvmd_enabled; then
+		echo -n "not required"
+		return 0
+	fi
+
 	if ! status fence_xvmd > /dev/null 2>&1; then
 		errmsg=$( @SBINDIR@/fence_xvmd $FENCE_XVMD_OPTS 2>&1 ) || return 1
 	fi
@@ -386,6 +396,11 @@ start_fence_xvmd()
 }
 
 xend_bridged_net_start() {
+	if ! xend_bridged_net_enabled; then
+		echo -n "not required"
+		return 0
+	fi
+
 	if [ ! -x /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then
 		if [ -f /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then
 			errmsg='The xend bridged network script cannot be run'
@@ -430,15 +445,10 @@ start()
 	mkdir -p /var/run/cluster
 
 	echo -n "   Enable Xend bridge net workaround... "
-	if xend_bridged_net_enabled; then
-		if xend_bridged_net_start; then
-			ok
-		else
-			nok
-		fi
-	else
-		echo -n "not required"
+	if xend_bridged_net_start; then
 		ok
+	else
+		nok
 	fi
 
 	echo -n "   Loading modules... "
@@ -491,27 +501,17 @@ start()
 	fi
 
 	echo -n "   Starting fencing... "
-	if fence_join_enabled; then
-		if start_fence; then
-			ok
-		else
-			nok
-		fi
-	else
-		echo -n "not required"
+	if start_fence; then
 		ok
+	else
+		nok
 	fi
 
 	echo -n "   Starting virtual machine fencing host... "
-	if fence_xvmd_enabled; then
-		if start_fence_xvmd; then
-			ok
-		else
-			nok
-		fi
-	else
-		echo -n "not required"
+	if start_fence_xvmd; then
 		ok
+	else
+		nok
 	fi
     
 	return 0
@@ -580,6 +580,10 @@ stop_qdiskd()
 
 stop_fence()
 {
+	if ! fence_join_enabled; then
+		return 0
+	fi
+
 	if status fenced > /dev/null 2>&1; then
 		@SBINDIR@/fence_tool leave -w 10 > /dev/null 2>&1
 		return $?
@@ -589,6 +593,10 @@ stop_fence()
 
 stop_fence_xvmd()
 {
+	if ! fence_xvmd_enabled; then
+		return 0
+	fi
+
 	if status fence_xvmd > /dev/null 2>&1; then
 		errmsg=$(pkill -TERM fence_xvmd) || return 1
 		sleep 1 # A bit of time for fenced to exit
@@ -609,25 +617,17 @@ stop()
 	echo "Stopping cluster: "
 
 	echo -n "   Stopping virtual machine fencing host... "
-	if fence_xvmd_enabled; then
-		if stop_fence_xvmd; then
-			ok
-		else
-			nok
-		fi
-	else
+	if stop_fence_xvmd; then
 		ok
+	else
+		nok
 	fi
 
 	echo -n "   Stopping fencing... "
-	if fence_join_enabled; then
-		if stop_fence; then
-			ok
-		else
-			nok
-		fi
-	else
+	if stop_fence; then
 		ok
+	else
+		nok
 	fi
 
 	echo -n "   Stopping daemons... "


                 reply	other threads:[~2009-03-27 19:07 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=20090327190631.4403812020C@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).