cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Make handling of failed services consistent
Date: Fri,  8 Jul 2011 13:06:14 -0400	[thread overview]
Message-ID: <1310144774-24785-1-git-send-email-lhh@redhat.com> (raw)

For RHEL6 branch.

See bugzilla for what has changed specifically.

Resolves: rhbz#673167

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/include/resgroup.h      |    1 +
 rgmanager/src/clulib/rg_strings.c |    3 ++-
 rgmanager/src/daemons/rg_state.c  |   24 +++++++++++++++++++-----
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h
index 2e81eb9..7119eac 100644
--- a/rgmanager/include/resgroup.h
+++ b/rgmanager/include/resgroup.h
@@ -196,6 +196,7 @@ int rg_unlock(struct dlm_lksb *p);
 
 
 /* Return codes */
+#define RG_EWARNING	-19		/* Warning (see logs) */
 #define RG_EPERM	-18		/* Permission denied */
 #define RG_ERELO	-17		/* Relocation failure; service running
 					   on original node */
diff --git a/rgmanager/src/clulib/rg_strings.c b/rgmanager/src/clulib/rg_strings.c
index b0cd184..868b91b 100644
--- a/rgmanager/src/clulib/rg_strings.c
+++ b/rgmanager/src/clulib/rg_strings.c
@@ -8,7 +8,8 @@ struct string_val {
 
 
 const struct string_val rg_error_strings[] = {
-	{ RG_EPERM,	"Permissing denied" },
+	{ RG_EWARNING,	"Warning; see system logs" },
+	{ RG_EPERM,	"Permission denied" },
 	{ RG_ERELO,	"Failed; service running on original owner" },
 	{ RG_EEXCL,	"Service not runnable: cannot run exclusive" },
 	{ RG_EDOMAIN,   "Service not runnable" },
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index babac7a..5501b3f 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1434,11 +1434,23 @@ _svc_stop(const char *svcName, int req, int recover, uint32_t newstate)
 
 	ret = group_op(svcName, RG_STOP);
 
-	if (old_state == RG_STATE_FAILED && newstate == RG_STATE_DISABLED) {
-		if (ret)
+	/* fix up return code on failure during disable */
+	if (ret)
+		ret = RG_EFAIL;
+
+	if ((old_state == RG_STATE_FAILED ||
+	     old_state == RG_STATE_DISABLED) &&
+	    newstate == RG_STATE_DISABLED) {
+		if (ret) {
+			/*
+			 * Return warning on disable-after-fail.
+			 * (mark it disabled anyway)
+			 */
 			logt_print(LOG_ALERT, "Marking %s as 'disabled', "
 			       "but some resources may still be allocated!\n",
 			       svcName);
+			ret = RG_EWARNING;
+		}
 		_svc_stop_finish(svcName, 0, newstate);
 	} else {
 		_svc_stop_finish(svcName, ret, newstate);
@@ -1474,8 +1486,10 @@ _svc_stop_finish(const char *svcName, int failed, uint32_t newstate)
 		return 0;
 	}
 
-	svcStatus.rs_last_owner = svcStatus.rs_owner;
-	svcStatus.rs_owner = 0;
+	if (svcStatus.rs_owner != 0) {
+		svcStatus.rs_last_owner = svcStatus.rs_owner;
+		svcStatus.rs_owner = 0;
+	}
 
 	if (failed) {
 		logt_print(LOG_CRIT, "#12: RG %s failed to stop; intervention "
@@ -1819,7 +1833,7 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
 		ret = _svc_stop(svcName, request, 0, RG_STATE_STOPPED);
 		if (ret == RG_EFAIL) {
 			svc_fail(svcName);
-			return RG_EFAIL;
+			return RG_EABORT;
 		}
 		if (ret == RG_EFROZEN) {
 			return RG_EFROZEN;
-- 
1.7.3.4



                 reply	other threads:[~2011-07-08 17: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=1310144774-24785-1-git-send-email-lhh@redhat.com \
    --to=lhh@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 NNTP newsgroup(s).