From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3715 invoked by alias); 27 Mar 2009 19:07:03 -0000 Received: (qmail 3613 invoked by alias); 27 Mar 2009 19:07:02 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.8 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: STABLE3 - cman init: move special checks where they belong To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: f12fafcd7b7ce7803fdb20b5662646d909745c75 X-Git-Newrev: baa58122d5fb7957c2955cb39ed32613a9edb664 From: "Fabio M. Di Nitto" Message-Id: <20090327190631.4403812020C@lists.fedorahosted.org> Date: Fri, 27 Mar 2009 19:07: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/msg00945.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=baa58122d5fb7957c2955cb39ed32613a9edb664 Commit: baa58122d5fb7957c2955cb39ed32613a9edb664 Parent: f12fafcd7b7ce7803fdb20b5662646d909745c75 Author: Fabio M. Di Nitto AuthorDate: Wed Mar 25 15:06:30 2009 +0100 Committer: Fabio M. Di Nitto 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 --- 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... "