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: group some checks together Date: Fri, 27 Mar 2009 19:07:00 -0000 [thread overview] Message-ID: <20090327190629.0A61212020C@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f12fafcd7b7ce7803fdb20b5662646d909745c75 Commit: f12fafcd7b7ce7803fdb20b5662646d909745c75 Parent: 2df3b5526eaaf6cc356b2e9cb864b1f099af4cf5 Author: Fabio M. Di Nitto <fdinitto@redhat.com> AuthorDate: Wed Mar 25 14:31:15 2009 +0100 Committer: Fabio M. Di Nitto <fdinitto@redhat.com> CommitterDate: Fri Mar 27 20:05:45 2009 +0100 cman init: group some checks together remove redundant checks and turn them into reusable functions Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- cman/init.d/cman.in | 83 +++++++++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 36 deletions(-) diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in index 1a1be6c..d2665d3 100644 --- a/cman/init.d/cman.in +++ b/cman/init.d/cman.in @@ -227,6 +227,41 @@ mtab_configfs() return $? } +qdiskd_enabled() +{ + ccs_tool query /cluster/quorumd >/dev/null 2>&1 + return $? +} + +groupd_enabled() +{ + if [ "$(ccs_tool query /cluster/group/@groupd_compat 2>/dev/null || true)" != "0" ]; then + return 0 + else + return 1 + fi +} + +cmannotifyd_enabled() +{ + case "$CMAN_NOTIFYD_START" in + yes) + return 0 + ;; + no) + return 1 + ;; + conditional) + if [ -n "$(ls -1 @NOTIFYDDIR@ 2>/dev/null)" ]; then + return 0 + fi + ;; + *) + return 1 + ;; + esac +} + load_modules() { errmsg=$( /sbin/modprobe configfs 2>&1 ) || return 1 @@ -301,7 +336,7 @@ unfence_self() start_qdiskd() { if ! status qdiskd > /dev/null 2>&1 && \ - ccs_tool query /cluster/quorumd >/dev/null 2>&1; then + qdiskd_enabled; then errmsg=$( @SBINDIR@/qdiskd -Q 2>&1 ) || return 1 fi return 0 @@ -310,7 +345,7 @@ start_qdiskd() start_daemons() { if ! status groupd > /dev/null 2>&1 && \ - [ "$(ccs_tool query /cluster/group/@groupd_compat 2>/dev/null || true)" != "0" ]; then + groupd_enabled; then errmsg=$( @SBINDIR@/groupd 2>&1 ) || return 1 fi if ! status fenced > /dev/null 2>&1 ; then @@ -322,24 +357,9 @@ start_daemons() if ! status gfs_controld > /dev/null 2>&1; then errmsg=$( @SBINDIR@/gfs_controld 2>&1 ) || return 1 fi - if ! status cmannotifyd > /dev/null 2>&1; then - case "$CMAN_NOTIFYD_START" in - yes) - errmsg=$(@SBINDIR@/cmannotifyd 2>&1 ) || return 1 - ;; - no) - # nothing to do - ;; - conditional) - if [ -n "$(ls -1 @NOTIFYDDIR@ 2>/dev/null)" ]; then - errmsg=$(@SBINDIR@/cmannotifyd 2>&1 ) || return 1 - fi - ;; - *) - errmsg="unknown CMAN_NOTIFYD_START option" - return 1 - ;; - esac + if ! status cmannotifyd > /dev/null 2>&1 && \ + cmannotifyd_enabled; then + errmsg=$(@SBINDIR@/cmannotifyd 2>&1 ) || return 1 fi return 0 } @@ -654,7 +674,7 @@ stop() cmanstatus() { - if [ "$(ccs_tool query /cluster/group/@groupd_compat 2>/dev/null || true)" != "0" ]; then + if groupd_enabled; then errmsg=$( status groupd 2>&1) || return 1 fi @@ -662,28 +682,19 @@ cmanstatus() errmsg=$( status dlm_controld 2>&1) || return 1 errmsg=$( status gfs_controld 2>&1) || return 1 - case "$CMAN_NOTIFYD_START" in - yes) + if cmannotifyd_enabled; then errmsg=$( status cmannotifyd 2>&1) || return 1 - ;; - no) - # nothing to do - ;; - conditional) - if [ -n "$(ls -1 @NOTIFYDDIR@ 2>/dev/null)" ]; then - errmsg=$( status cmannotifyd 2>&1) || return 1 - fi - ;; - esac + fi - if ccs_tool query /cluster/quorumd >/dev/null 2>&1; then + if qdiskd_enabled; then errmsg=$( status qdiskd 2>&1) || return 1 fi errmsg=$( status corosync 2>&1) || return 1 - fence_xvmd_enabled || return 0 - errmsg=$( status fence_xvmd 2>&1) || return 1 + if fence_xvmd_enabled; then + errmsg=$( status fence_xvmd 2>&1) || return 1 + fi return 0 }
reply other threads:[~2009-03-27 19:06 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=20090327190629.0A61212020C@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).