cluster: RHEL55 - rgmanager: Remove async migration semantics
Lon Hohberger
lon at fedoraproject.org
Mon Dec 14 22:24:14 UTC 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=94ce529d73ea7113f31fb9a369d7780e44fb7f5a
Commit: 94ce529d73ea7113f31fb9a369d7780e44fb7f5a
Parent: ef388d3cba37b8779dd7fe31073867c3ee244daf
Author: Lon Hohberger <lhh at redhat.com>
AuthorDate: Mon Oct 19 13:18:54 2009 -0400
Committer: Lon Hohberger <lhh at redhat.com>
CommitterDate: Mon Dec 14 17:17:59 2009 -0500
rgmanager: Remove async migration semantics
Migration is a synchronous operation on both Xen and
KVM; we can rely on the return code.
Resolves: rhbz#499835
Part 1 of 2
Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
rgmanager/src/daemons/rg_state.c | 53 +++++++++----------------------------
1 files changed, 13 insertions(+), 40 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 46fccad..d68ce9b 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -866,7 +866,8 @@ svc_start(char *svcName, int req)
/**
- * Migrate a service to another node.
+ * Migrate a service to another node. Relies on agent
+ * operating synchronously
*/
int
svc_migrate(char *svcName, int target)
@@ -944,20 +945,8 @@ svc_migrate(char *svcName, int target)
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) {
- clulog(LOG_ERR,
- "#75: Failed changing service status\n");
- rg_unlock(&lockp);
- return RG_EFAIL;
- }
rg_unlock(&lockp);
-
+
ret = group_migrate(svcName, target);
switch(ret) {
@@ -976,45 +965,29 @@ svc_migrate(char *svcName, int target)
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;
+ break;
}
- /* 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. */
+ /* Success - flip owner in state info */
if (rg_lock(svcName, &lockp) < 0) {
- clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+ clulog(LOG_ERR, "#45b: Unable to obtain cluster lock: %s\n",
strerror(errno));
- return ret;
- }
-
- if (get_rg_state(svcName, &svcStatus) != 0) {
- rg_unlock(&lockp);
- clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
- svcName);
- return ret;
- }
-
- 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;
+ 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;
}
More information about the cluster-commits
mailing list