cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/xvm fence_xvmd.c
Date: 19 Nov 2007 17:28:33 -0000	[thread overview]
Message-ID: <20071119172833.14937.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh at sourceware.org	2007-11-19 17:28:33

Modified files:
	fence/agents/xvm: fence_xvmd.c 

Log message:
	Ancillary NOCLUSTER mode fixes for fence_xvmd

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvmd.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.9&r2=1.4.2.10

--- cluster/fence/agents/xvm/fence_xvmd.c	2007/11/19 17:03:27	1.4.2.9
+++ cluster/fence/agents/xvm/fence_xvmd.c	2007/11/19 17:28:33	1.4.2.10
@@ -224,6 +224,7 @@
 {
 	int fd = -1, ret = -1;
 	virDomainPtr vdp;
+	virDomainInfo vdi;
 	char response = 1;
 	char *domain_desc, *domain_desc_sanitized;
 	size_t sz;
@@ -247,13 +248,18 @@
 		break;
 	case FENCE_OFF:
 		printf("Destroying domain %s...\n", (char *)req->domain);
-		if (!vdp && (flags & F_NOCLUSTER)) {
-			dbg_printf(2, "[OFF + NOCLUSTER] Nothing to do - "
-				   "domain does not exist\n");
-			response = 0;
-			break;
+		if (flags & F_NOCLUSTER) {
+			if (!vdp ||
+			    ((virDomainGetInfo(vdp, &vdi) == 0) &&
+			     (vdi.state == VIR_DOMAIN_SHUTOFF))) {
+				dbg_printf(2, "[NOCLUSTER] Nothing to "
+					   "do - domain does not exist\n");
+				response = 0;
+				break;
+			}
 		}
 
+
 		dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
 		ret = virDomainDestroy(vdp);
 		if (ret < 0) {
@@ -271,11 +277,15 @@
 		printf("Rebooting domain %s...\n",
 		       (char *)req->domain);
 
-		if (!vdp && (flags & F_NOCLUSTER)) {
-			dbg_printf(2, "[REBOOT + NOCLUSTER] Nothing to do - "
-				   "domain does not exist\n");
-			response = 0;
-			break;
+		if (flags & F_NOCLUSTER) {
+			if (!vdp ||
+			    ((virDomainGetInfo(vdp, &vdi) == 0) &&
+			     (vdi.state == VIR_DOMAIN_SHUTOFF))) {
+				dbg_printf(2, "[NOCLUSTER] Nothing to "
+					   "do - domain does not exist\n");
+				response = 0;
+				break;
+			}
 		}
 
 		domain_desc = virDomainGetXMLDesc(vdp, 0);
@@ -320,7 +330,7 @@
 		}
 		break;
 	}
-	
+
 	dbg_printf(3, "Sending response to caller...\n");
 	if (write(fd, &response, 1) < 0) {
 		perror("write");



             reply	other threads:[~2007-11-19 17:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19 17:28 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-14 14:49 [Cluster-devel] cluster/fence/agents/xvm fence_xvmd.c fabbione
2007-10-17 18:29 lhh
2007-10-17 18:21 lhh
2007-09-11 13:44 pcaulfield
2007-01-10 20:31 lhh
2007-01-10 20:30 lhh
2007-01-10 20:25 lhh
2006-12-04 17:26 lhh
2006-12-04 17:26 lhh
2006-12-04 17:25 lhh
2006-12-01 22:14 lhh
2006-12-01 22:13 lhh

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=20071119172833.14937.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /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 NNTP newsgroup(s).