public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL53 - rgmanager: Fix VM restart issue
@ 2009-03-23 14:50 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-03-23 14:50 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=6581d5aef1ed4e316dc9453ee7ca912437f97a1f
Commit:        6581d5aef1ed4e316dc9453ee7ca912437f97a1f
Parent:        2e7ffe3afad987f26ea1cbd8f2d9594af5004c3e
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Mar 19 11:56:57 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Mar 23 10:49:54 2009 -0400

rgmanager: Fix VM restart issue

Problem description:

* node A starts vm:foo.  Before starting vm:foo, it asks
the rest of the cluster if they have seen vm:foo

* node B receives a status inquiry request from node A.
It then executes a status check on that VM to see if it
is running.  It's not, so status returns 1.  At this
point, node B sets a NEEDSTOP flag.

* Suppose you disable the VM on node A and start it on
node B now.  At this point, the NEEDSTOP flag is still
persisted on node B, but is ignored by the start/status
checks.

* If you then do a configuration update, the NEEDSTOP flag
is -still- there.  After a configuration update (or during
a special "recover" operation", the NEEDSTOP flag is used
by rgmanager to decide what resources need to be stopped
or not.  Presence of this flag does NOT alter service state.

* Rgmanager does its reconfiguration, sees the NEESTOP flag,
and stops the virtual machine.  Because the state has not
actually changed according to rgmanager (NEEDSTOP is
succeeded by NEEDSTART if a resource's parameters have changed,
for example), the next status check causes a recovery of
the VM and then the VM is restarted.

Solution:

* Don't set NEEDSTOP during STATUS_INQUIRY

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/include/res-ocf.h      |    1 +
 rgmanager/src/daemons/groups.c   |    3 +++
 rgmanager/src/daemons/restree.c  |   28 +++++++++++++++++++++++++++-
 rgmanager/src/daemons/rg_state.c |    2 +-
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/rgmanager/include/res-ocf.h b/rgmanager/include/res-ocf.h
index 89a7d56..ce8e1f3 100644
--- a/rgmanager/include/res-ocf.h
+++ b/rgmanager/include/res-ocf.h
@@ -64,5 +64,6 @@
 #define RS_VALIDATE	(12)
 #define RS_MIGRATE	(13)
 #define RS_RECONFIG	(14)
+#define RS_STATUS_INQUIRY (15)	/** Quick status */
 
 #endif
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index 627953b..d973e73 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -982,6 +982,9 @@ group_op(char *groupname, int op)
 	case RG_STATUS:
 		ret = res_status(&_tree, res, NULL);
 		break;
+	case RG_STATUS_INQUIRY:
+		ret = res_status_inquiry(&_tree, res, NULL);
+		break;
 	case RG_CONDSTOP:
 		ret = res_condstop(&_tree, res, NULL);
 		break;
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 802685e..e88fbe2 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -1359,7 +1359,19 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 			++node->rn_resource->r_incarnations;
 			node->rn_state = RES_STARTED;
 		}
-	} else if (me && (op == RS_STATUS)) {
+	} else if (me && (op == RS_STATUS || op == RS_STATUS_INQUIRY)) {
+
+		/* Special quick-check for status inquiry */
+		if (op == RS_STATUS_INQUIRY) {
+			if (res_exec(node, RS_STATUS, NULL, 0) != 0)
+				return SFL_FAILURE;
+
+			/* XXX: A migratable service (the only place this
+			 * check can be used) cannot have child dependencies
+			 * anyway, so this is a short-circuit. */
+			return 0;
+		}
+
 		/* Check status before children*/
 		rv = do_status(node);
 		if (rv != 0) {
@@ -1545,6 +1557,20 @@ res_status(resource_node_t **tree, resource_t *res, void *ret)
 
 
 /**
+   Check status of all occurrences of a resource in a tree
+
+   @param tree		Tree to search for our resource.
+   @param res		Resource to start/stop
+   @param ret		Unused
+ */
+int
+res_status_inquiry(resource_node_t **tree, resource_t *res, void *ret)
+{
+	return _res_op(tree, res, NULL, ret, RS_STATUS_INQUIRY);
+}
+
+
+/**
    Grab resource info for all occurrences of a resource in a tree
 
    @param tree		Tree to search for our resource.
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index d0e0da6..3b4df10 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1271,7 +1271,7 @@ svc_status_inquiry(char *svcName)
 	if (svcStatus.rs_flags & RG_FLAG_FROZEN)
 		return 0;
 	
-	return group_op(svcName, RG_STATUS);
+	return group_op(svcName, RG_STATUS_INQUIRY);
 }
 
 


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

only message in thread, other threads:[~2009-03-23 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23 14:50 cluster: RHEL53 - rgmanager: Fix VM restart 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).