public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* rgmanager: master - rgmanager: Fix restart-after-migrate issue
@ 2009-06-22 16:54 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-06-22 16:54 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/rgmanager.git?p=rgmanager.git;a=commitdiff;h=b05f0232be04683e6ac13f2ef0e40e01b7e76695
Commit:        b05f0232be04683e6ac13f2ef0e40e01b7e76695
Parent:        f6b0f97da4ea4374f0e0b7e2f7a42d99af6371b5
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Jun 11 11:30:56 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Jun 22 12:47:26 2009 -0400

rgmanager: Fix restart-after-migrate issue

* Ensures we use RG_STATUS_INQUIRY when determining
if migration has completed
* Ensures that subsequent RG_STATUS checks clear any
NEEDSTOP flags to reduce the risk of other (yet-unknown)
conditions causing erroneous restarts

Resolves Red Hat Bugzilla #505340

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/daemons/restree.c  |   13 ++++++++-----
 rgmanager/src/daemons/rg_state.c |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 5ab4b3d..8575d16 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -1083,18 +1083,20 @@ _res_op_by_level(resource_node_t **tree, resource_t *first, void *ret,
 
 
 void
-mark_nodes(resource_node_t *node, int state, int flags)
+mark_nodes(resource_node_t *node, int state, int setflags, int clearflags)
 {
 	int x;
 	resource_node_t *child;
 
 	list_for(&node->rn_child, child, x) {
 		if (child->rn_child)
-			mark_nodes(child->rn_child, state, flags);
+			mark_nodes(child->rn_child, state, setflags,
+				   clearflags);
 	}
 
 	node->rn_state = state;
-	node->rn_flags |= (RF_NEEDSTART | RF_NEEDSTOP);
+	node->rn_flags |= (setflags);
+	node->rn_flags &= ~(clearflags);
 }
 
 
@@ -1356,7 +1358,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 			   node is independent or not.
 			 */
 			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
+				   RF_NEEDSTART | RF_NEEDSTOP, 0);
 
 			/* If we're an independent subtree, return a flag
 			   stating that this section is recoverable apart
@@ -1369,6 +1371,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 			return SFL_FAILURE;
 		}
 
+		mark_nodes(node, RES_STARTED, 0, RF_NEEDSTOP);
 	}
 
        if (node->rn_child) {
@@ -1383,7 +1386,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 		if (op == RS_STATUS && (rv & SFL_FAILURE) &&
 		    (node->rn_flags & RF_INDEPENDENT)) {
 			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
+				   RF_NEEDSTART | RF_NEEDSTOP, 0);
 			rv = SFL_RECOVERABLE;
 		}
 	}
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 4808ddf..cddbaa6 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1157,12 +1157,20 @@ svc_status(char *svcName)
 		/* Don't check status for anything not owned */
 		return 0;
 
-	if (svcStatus.rs_state != RG_STATE_STARTED &&
-	    svcStatus.rs_state != RG_STATE_MIGRATE)
+	if (svcStatus.rs_state == RG_STATE_STARTED) {
+		/* Running locally and not migrating = normal status
+		 * check
+		 */
+		ret = group_op(svcName, RG_STATUS);
+	} else if (svcStatus.rs_state == RG_STATE_MIGRATE) {
+		/* Migrating resources need an inquiry check to avoid
+		 * setting NEEDSTOP/NEEDSTART in the resource tree.
+		 */
+		ret = group_op(svcName, RG_STATUS_INQUIRY);
+	} else {
 		/* Not-running RGs should not be checked either. */
 		return 0;
-
-	ret = group_op(svcName, RG_STATUS);
+	}
 
 	/* For running services, if the return code is 0, we're done*/
 	if (svcStatus.rs_state == RG_STATE_STARTED)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-22 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 16:54 rgmanager: master - rgmanager: Fix restart-after-migrate issue Lon Hohberger

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).