From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1877 invoked by alias); 27 Mar 2009 19:06:43 -0000 Received: (qmail 1848 invoked by alias); 27 Mar 2009 19:06:42 -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: group all check functions together 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: ba5ec133c6cc16d4f6f4bb4113f261715b7390fc X-Git-Newrev: 4de2bc51f215efb94358206f34525a12f747c1eb From: "Fabio M. Di Nitto" Message-Id: <20090327190618.10CB312020C@lists.fedorahosted.org> Date: Fri, 27 Mar 2009 19:06: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/msg00941.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4de2bc51f215efb94358206f34525a12f747c1eb Commit: 4de2bc51f215efb94358206f34525a12f747c1eb Parent: ba5ec133c6cc16d4f6f4bb4113f261715b7390fc Author: Fabio M. Di Nitto AuthorDate: Wed Mar 25 11:43:49 2009 +0100 Committer: Fabio M. Di Nitto CommitterDate: Fri Mar 27 20:05:45 2009 +0100 cman init: group all check functions together make also sure they are in the right order as some of them depend on eachother Signed-off-by: Fabio M. Di Nitto --- cman/init.d/cman.in | 142 +++++++++++++++++++++++++-------------------------- 1 files changed, 70 insertions(+), 72 deletions(-) diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in index bf40226..6a6e1bd 100644 --- a/cman/init.d/cman.in +++ b/cman/init.d/cman.in @@ -138,6 +138,9 @@ fi # openaisparser - use internal openais config file parser. [ -n "$CONFIG_LOADER" ] && cman_join_opts+=" -C $CONFIG_LOADER" + +### helper/common functions + ok() { success echo @@ -149,6 +152,73 @@ nok() { exit 1 } +xend_bridged_net_enabled() { + # Not a xen kernel + test -d /proc/xen || return 1 + + current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null) + if [ -z "$current_runlevel" ]; then + errmsg='Unable to determine the current runlevel' + return 1 + fi + + if ! chkconfig --levels "$current_runlevel" xend 2>/dev/null; then + # xend doesn't start at this runlevel. + return 1 + fi + + if [ ! -f /etc/xen/xend-config.sxp ]; then + # xend isn't configured to use bridged networking. + return 1 + fi + + if ! egrep "^[[:blank:]]*\([[:blank:]]*network-script[[:blank:]]+(')?[[:blank:]]*${NETWORK_BRIDGE_SCRIPT}([[:blank:]]*\)|[[:blank:]]+)" /etc/xen/xend-config.sxp >&/dev/null; then + # xend isn't configured to use bridged networking. + return 1 + fi + return 0 +} + +fence_join_enabled() +{ + # + # Check the value of FENCE_JOIN. + # If FENCE_JOIN is set to "no", we will not attempt to join + # the fence domain. If FENCE_JOIN is set to any other value, + # we will attempt to join the fence domain (default). + # + if [ "$FENCE_JOIN" = "no" ]; then + return 1 + else + return 0 + fi +} + +fence_xvmd_enabled() +{ + fence_join_enabled || return 1 + + # + # Check for the 'xm' binary. If it's not here, we are not + # running on a machine capable of running xvmd. + # + which xm > /dev/null 2>&1 || return 1 + + # + # Check for presence of /cluster/fence_xvmd in cluster.conf + # (If -X is specified, it doesn't matter if it's in cluster.conf; + # we'll start it anyway since ccsd is not required) + # + if @SBINDIR@/cman_tool status > /dev/null 2>&1; then + if [ "$FENCE_XVMD_OPTS" = "${FENCE_XVMD_OPTS/-X/}" ]; then + @SBINDIR@/ccs_tool query /cluster/fence_xvmd || return 1 + fi + fi + + return 0 +} + + load_modules() { errmsg=$( /sbin/modprobe configfs 2>&1 ) || return 1 @@ -295,33 +365,6 @@ start_fence_xvmd() return 0 } -xend_bridged_net_enabled() { - # Not a xen kernel - test -d /proc/xen || return 1 - - current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null) - if [ -z "$current_runlevel" ]; then - errmsg='Unable to determine the current runlevel' - return 1 - fi - - if ! chkconfig --levels "$current_runlevel" xend 2>/dev/null; then - # xend doesn't start at this runlevel. - return 1 - fi - - if [ ! -f /etc/xen/xend-config.sxp ]; then - # xend isn't configured to use bridged networking. - return 1 - fi - - if ! egrep "^[[:blank:]]*\([[:blank:]]*network-script[[:blank:]]+(')?[[:blank:]]*${NETWORK_BRIDGE_SCRIPT}([[:blank:]]*\)|[[:blank:]]+)" /etc/xen/xend-config.sxp >&/dev/null; then - # xend isn't configured to use bridged networking. - return 1 - fi - return 0 -} - xend_bridged_net_start() { if [ ! -x /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then if [ -f /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then @@ -339,36 +382,6 @@ xend_bridged_net_start() { return 0 } -fence_xvmd_enabled() -{ - # - # Check the value of FENCE_JOIN. - # If FENCE_JOIN is set to "no", then we should disable fence_xvm. - # - if [ "$FENCE_JOIN" = "no" ]; then - return 1 - fi - - # - # Check for the 'xm' binary. If it's not here, we are not - # running on a machine capable of running xvmd. - # - which xm > /dev/null 2>&1 || return 1 - - # - # Check for presence of /cluster/fence_xvmd in cluster.conf - # (If -X is specified, it doesn't matter if it's in cluster.conf; - # we'll start it anyway since ccsd is not required) - # - if @SBINDIR@/cman_tool status > /dev/null 2>&1; then - if [ "$FENCE_XVMD_OPTS" = "${FENCE_XVMD_OPTS/-X/}" ]; then - @SBINDIR@/ccs_tool query /cluster/fence_xvmd || return 1 - fi - fi - - return 0 -} - set_networking_params() { if [ ! -f /proc/sys/net/core/rmem_default ]; then @@ -386,21 +399,6 @@ set_networking_params() fi } -fence_join_enabled() -{ - # - # Check the value of FENCE_JOIN. - # If FENCE_JOIN is set to "no", we will not attempt to join - # the fence domain. If FENCE_JOIN is set to any other value, - # we will attempt to join the fence domain (default). - # - if [ "$FENCE_JOIN" = "no" ]; then - return 1 - else - return 0 - fi -} - start() { echo "Starting cluster: "