This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: RHEL5 - rgmanager: Fix restart-after-migrate issue


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=47f11a83f75e8b6ea332dc64bf74bce793b0388e
Commit:        47f11a83f75e8b6ea332dc64bf74bce793b0388e
Parent:        400a33b0a5f715702a419c46a10d0b3491130a53
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Jun 11 11:30:56 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Thu Jun 11 15:29:55 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, and
* Fixes erroneous migration_mapping noise.

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 ++++++++++++----
 rgmanager/src/resources/vm.sh    |    2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 9119a87..6de7c49 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -1112,18 +1112,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);
 }
 
 
@@ -1385,7 +1387,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
@@ -1398,6 +1400,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) {
@@ -1412,7 +1415,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 cda9130..3660b71 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1168,12 +1168,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)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 1d6a0da..8285cd6 100755
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -109,7 +109,7 @@ meta_data()
             <content type="string"/>
         </parameter>
 
-       <parameter name="migration_mapping">
+       <parameter name="migration_mapping" reconfig="1">
            <longdesc lang="en">
                Mapping of the hostname of a target cluster member to a different hostname
            </longdesc>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]