public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: RHEL5 - fence: Make fence_xvmd try two methods on reboot
Date: Fri, 27 Mar 2009 14:47:00 -0000	[thread overview]
Message-ID: <20090327142619.D237A120150@lists.fedorahosted.org> (raw)

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");


                 reply	other threads:[~2009-03-27 14:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090327142619.D237A120150@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).