public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL5 - fence: Make fence_xvmd try two methods on reboot
@ 2009-03-27 14:47 Lon Hohberger
0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-03-27 14:47 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c635f24c2fe4e07dd40c27dc7c44629b6ddbf045
Commit: c635f24c2fe4e07dd40c27dc7c44629b6ddbf045
Parent: b90358e8b77d0dfbfed4335757feda76d0b677a9
Author: Lon Hohberger <lhh@redhat.com>
AuthorDate: Tue Mar 24 14:24:15 2009 -0400
Committer: Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Mar 27 10:25:09 2009 -0400
fence: Make fence_xvmd try two methods on reboot
rhbz480178
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
fence/agents/xvm/fence_xvmd.c | 71 +++++++++++++++++++++++++++++-----------
1 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c
index 1d496d2..1c22039 100644
--- a/fence/agents/xvm/fence_xvmd.c
+++ b/fence/agents/xvm/fence_xvmd.c
@@ -291,20 +291,7 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
domain_desc = virDomainGetXMLDesc(vdp, 0);
- if (domain_desc) {
- dbg_printf(3, "[[ XML Domain Info ]]\n");
- dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
-
- sz = 0;
- if (cleanup_xml(domain_desc,
- &domain_desc_sanitized, &sz) == 0) {
- free(domain_desc);
- domain_desc = domain_desc_sanitized;
- }
-
- dbg_printf(3, "[[ XML Domain Info (modified) ]]\n");
- dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
- } else {
+ if (!domain_desc) {
printf("Failed getting domain description from "
"libvirt\n");
}
@@ -322,14 +309,58 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
if (response) {
printf("Domain still exists; fencing failed\n");
- } else if (domain_desc) {
- /* Recreate the domain if possible */
- /* Success */
- dbg_printf(2, "Calling virDomainCreateLinux()...\n");
- virDomainCreateLinux(vp, domain_desc, 0);
+ if (domain_desc)
+ free(domain_desc);
+ break;
+
+ }
+
+ if (!domain_desc)
+ break;
+
+ dbg_printf(3, "[[ XML Domain Info ]]\n");
+ dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
+ dbg_printf(2, "Calling virDomainCreateLinux()...\n");
+
+ /*
+ * Due to multiple versions of libvirt in RHEL5,
+ * we have to try this both ways:
+ * - first, assume they have the most current
+ * libvirt for RHEL (0.3.3+).
+ * - Next, assume they have the older release
+ * where the <os> block needed to be removed to
+ * ensure a proper "start"
+ *
+ * Testing of the most recent libvirt shows that
+ * virDomainCreateLinux() returns NULL even if
+ * it succeeds, though.
+ */
+ vdp = virDomainCreateLinux(vp, domain_desc, 0);
+ if (vdp != NULL) {
free(domain_desc);
+ break;
}
- break;
+
+ dbg_printf(1, "That didn't work. Trying older "
+ "libvirt workaround...\n");
+ sz = 0;
+ if (cleanup_xml(domain_desc,
+ &domain_desc_sanitized, &sz) == 0) {
+ free(domain_desc);
+ domain_desc = domain_desc_sanitized;
+ }
+
+ dbg_printf(3, "[[ XML Domain Info (modified) ]]\n");
+ dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
+ /* Recreate the domain if possible */
+ /* Success */
+ vdp = virDomainCreateLinux(vp, domain_desc, 0);
+ if (vdp == NULL)
+ dbg_printf(1, "Unable to restart domain.\n");
+
+ free(domain_desc);
+
+ break; /* case FENCE_REBOOT */
}
dbg_printf(3, "Sending response to caller...\n");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-27 14:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27 14:47 cluster: RHEL5 - fence: Make fence_xvmd try two methods on reboot 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).