Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=40…
Commit: 400cda7587885f24f997f3e5754acc0d901f95f1
Parent: 0bb947f3c9447879551eea0a79e61e026abc5972
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Oct 19 13:18:54 2009 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Oct 19 13:18:54 2009 -0400
rgmanager: Remove async migration semantics
Migration is a synchronous operation on both Xen and
KVM; we can rely on the return code.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 65 ++++++++++---------------------------
1 files changed, 18 insertions(+), 47 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index d137f45..ab18202 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -803,7 +803,8 @@ svc_start(const char *svcName, int req)
/**
- * Migrate a service to another node.
+ * Migrate a service to another node. Relies on agent
+ * operating synchronously
*/
int
svc_migrate(const char *svcName, int target)
@@ -875,21 +876,8 @@ svc_migrate(const char *svcName, int target)
rg_unlock(&lockp);
return RG_EFROZEN;
}
-
- /* LOCK HELD */
- svcStatus.rs_owner = target;
- svcStatus.rs_last_owner = my_id();
- svcStatus.rs_state = RG_STATE_MIGRATE;
- svcStatus.rs_transition = (uint64_t)time(NULL);
-
- if (set_rg_state(svcName, &svcStatus) != 0) {
- logt_print(LOG_ERR,
- "#75: Failed changing service status\n");
- rg_unlock(&lockp);
- return RG_EFAIL;
- }
rg_unlock(&lockp);
-
+
ret = group_migrate(svcName, target);
switch(ret) {
@@ -902,51 +890,34 @@ svc_migrate(const char *svcName, int target)
the target node simply died; in this case, set status
back to started */
return RG_EFAIL;
- break;
case OCF_RA_NOT_RUNNING:
/* For these two, the VM was either not running or
migration is simply impossible. */
/* Don't mark the service as failed; since it's either
recoverable or still running. */
- ret = RG_EFAIL;
- break;
+ return RG_EFAIL;
case OCF_RA_NOT_CONFIGURED:
- ret = RG_EINVAL;
- break;
+ return RG_EINVAL;
case 0:
- return 0;
- }
-
- /* Ok, we've hit a recoverable condition. Since VMs and migratory
- services are ... well, migratable, we can just flip the state
- back to 'started' and error checking will fix it later. */
- if (rg_lock(svcName, &lockp) < 0) {
- logt_print(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
- strerror(errno));
- return ret;
- }
-
- if (get_rg_state(svcName, &svcStatus) != 0) {
- rg_unlock(&lockp);
- logt_print(LOG_ERR, "#46: Failed getting status for RG %s\n",
- svcName);
- return ret;
+ break;
}
- if (svcStatus.rs_last_owner != (uint32_t)my_id() ||
- svcStatus.rs_owner != (uint32_t)target ||
- svcStatus.rs_state != RG_STATE_MIGRATE) {
- rg_unlock(&lockp);
- return ret;
+ /* Success - flip owner in state info */
+ if (rg_lock(svcName, &lockp) < 0) {
+ logt_print(LOG_ERR, "#45b: Unable to obtain cluster lock: %s\n",
+ strerror(errno));
+ return RG_EFAIL;
}
-
- svcStatus.rs_owner = my_id();
+
+ /* No need for a 'get' here since the service is still STARTED */
+ svcStatus.rs_last_owner = svcStatus.rs_owner;
+ svcStatus.rs_owner = target;
svcStatus.rs_state = RG_STATE_STARTED;
-
+
set_rg_state(svcName, &svcStatus);
rg_unlock(&lockp);
-
- return ret;
+
+ return 0;
}
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5f…
Commit: 5fb3efb518b2be4e7f3cd141e1643cb449b8a9c5
Parent: 7d9a687e70599b6473d75e7868480b6e9e9d9210
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Tue Jul 28 08:46:36 2009 +0100
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Thu Oct 15 08:18:07 2009 +0100
cman: make cman_tool leave remove work even when no services are running.
cman_tool leave takes a shortcut internally if no services are listening
for shutdown events. Unfortunately, a bug in this shortcut means that the
leave flags gets lost, so quorum is not adjusted downwards.
This patch fixes that shortcut. I should make it clear that 'leave remove'
works fine if any cluster services are running.
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/commands.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 402efbb..29a9f1f 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -948,6 +948,13 @@ static int do_cmd_try_shutdown(struct connection *con, char *cmdbuf)
/* If no-one is listening for events then we can just go down now */
if (shutdown_expected == 0) {
send_leave(CLUSTER_LEAVEFLAG_DOWN);
+ int leaveflags = CLUSTER_LEAVEFLAG_DOWN;
+
+ quit_threads = 1;
+ if (shutdown_flags & SHUTDOWN_REMOVE)
+ leaveflags |= CLUSTER_LEAVEFLAG_REMOVED;
+
+ send_leave(leaveflags);
return 0;
}
else {