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: introduce runwrap local function and use it Date: Fri, 27 Mar 2009 19:07:00 -0000 [thread overview] Message-ID: <20090327190635.88E0512020C@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=388e3e47c36e49fc2a414d86b4de52b408955342 Commit: 388e3e47c36e49fc2a414d86b4de52b408955342 Parent: 4c237dd55d272ee11ba97ffd9a730a3d83ff6069 Author: Fabio M. Di Nitto <fdinitto@redhat.com> AuthorDate: Wed Mar 25 15:42:50 2009 +0100 Committer: Fabio M. Di Nitto <fdinitto@redhat.com> CommitterDate: Fri Mar 27 20:05:46 2009 +0100 cman init: introduce runwrap local function and use it runwrap takes in input the function to call and the message to print and does the right thing while checking return codes and inform the user. This collapse a lot of stuff within start/stop functions Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- cman/init.d/cman.in | 159 ++++++++++++--------------------------------------- 1 files changed, 36 insertions(+), 123 deletions(-) diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in index 801ed19..27429c7 100644 --- a/cman/init.d/cman.in +++ b/cman/init.d/cman.in @@ -268,6 +268,20 @@ cmannotifyd_enabled() esac } +runwrap() +{ + function=$1 + shift + message="$@" + + echo -n " $message... " + if $function; then + ok + else + nok + fi +} + ### the real stuff starts here load_modules() @@ -452,75 +466,16 @@ start() # required for distributions that use tmpfs for /var/run mkdir -p /var/run/cluster - echo -n " Enable Xend bridge net workaround... " - if xend_bridged_net_start; then - ok - else - nok - fi - - echo -n " Loading modules... " - if load_modules; then - ok - else - nok - fi - - echo -n " Mounting configfs... " - if start_configfs; then - ok - else - nok - fi - - echo -n " Setting network parameters... " - if set_networking_params; then - ok - else - nok - fi - - echo -n " Starting cman... " - if start_cman; then - ok - else - nok - fi - - echo -n " Unfencing self... " - if unfence_self; then - ok - else - nok - fi - - echo -n " Starting qdiskd... " - if start_qdiskd; then - ok - else - nok - fi - - echo -n " Starting daemons... " - if start_daemons; then - ok - else - nok - fi - - echo -n " Starting fencing... " - if start_fence; then - ok - else - nok - fi - - echo -n " Starting virtual machine fencing host... " - if start_fence_xvmd; then - ok - else - nok - fi + runwrap xend_bridged_net_start "Enable Xend bridge net workaround" + runwrap load_modules "Loading modules" + runwrap start_configfs "Mounting configfs" + runwrap set_networking_params "Setting network parameters" + runwrap start_cman "Starting cman" + runwrap unfence_self "Unfencing self" + runwrap start_qdiskd "Starting qdiskd" + runwrap start_daemons "Starting daemons" + runwrap start_fence "Starting fencing" + runwrap start_fence_xvmd "Starting virtual machine fencing host" return 0 } @@ -541,7 +496,7 @@ stop_cman() { if cman_running; then errmsg=$( @SBINDIR@/cman_tool -t $CMAN_SHUTDOWN_TIMEOUT \ - -w leave $1 2>&1 ) || return 1 + -w leave $cmanremove 2>&1 ) || return 1 fi return 0 # all ok } @@ -624,58 +579,14 @@ stop() { echo "Stopping cluster: " - echo -n " Stopping virtual machine fencing host... " - if stop_fence_xvmd; then - ok - else - nok - fi - - echo -n " Stopping fencing... " - if stop_fence; then - ok - else - nok - fi - - echo -n " Stopping daemons... " - if stop_daemons; then - ok - else - nok - fi - - echo -n " Stopping qdiskd... " - if stop_qdiskd; then - ok - else - nok - fi - - echo -n " Stopping cman... " - if stop_cman "$1"; then - ok - else - nok - fi - - echo -n " Stopping cmannotifyd... " - if stop_cmannotifyd; then - ok - else - nok - fi - - echo -n " Unloading modules..." - unload_modules - ok - - echo -n " Unmounting configfs... " - if stop_configfs; then - ok - else - nok - fi + runwrap stop_fence_xvmd "Stopping virtual machine fencing host" + runwrap stop_fence "Stopping fencing" + runwrap stop_daemons "Stopping daemons" + runwrap stop_qdiskd "Stopping qdiskd" + runwrap stop_cman "Stopping cman" + runwrap stop_cmannotifyd "Stopping cmannotifyd" + runwrap unload_modules "Unloading modules" + runwrap stop_configfs "Unmounting configfs" return 0 } @@ -720,6 +631,7 @@ start) fi ;; stop) + cmanremove="" if stop; then rm -f $LOCK_FILE else @@ -729,7 +641,8 @@ stop) ;; restart|reload) echo -n "Restarting cluster: " - if stop remove > /dev/null 2>&1 && \ + cmanremove=remove + if stop > /dev/null 2>&1 && \ start > /dev/null 2>&1; then ok else
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=20090327190635.88E0512020C@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: linkBe 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).