Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   [Cluster-devel] cluster/fence/agents/xvm fence_xvmd.c (http://www.linux-archive.org/cluster-development/656-cluster-devel-cluster-fence-agents-xvm-fence_xvmd-c.html)

11-19-2007 04:28 PM

[Cluster-devel] cluster/fence/agents/xvm fence_xvmd.c
 
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: lhh@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=RH EL5&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...
", (char *)req->domain);
- if (!vdp && (flags & F_NOCLUSTER)) {
- dbg_printf(2, "[OFF + NOCLUSTER] Nothing to do - "
- "domain does not exist
");
- 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
");
+ response = 0;
+ break;
+ }
}

+
dbg_printf(2, "[OFF] Calling virDomainDestroy
");
ret = virDomainDestroy(vdp);
if (ret < 0) {
@@ -271,11 +277,15 @@
printf("Rebooting domain %s...
",
(char *)req->domain);

- if (!vdp && (flags & F_NOCLUSTER)) {
- dbg_printf(2, "[REBOOT + NOCLUSTER] Nothing to do - "
- "domain does not exist
");
- 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
");
+ response = 0;
+ break;
+ }
}

domain_desc = virDomainGetXMLDesc(vdp, 0);
@@ -320,7 +330,7 @@
}
break;
}
-
+
dbg_printf(3, "Sending response to caller...
");
if (write(fd, &response, 1) < 0) {
perror("write");


All times are GMT. The time now is 05:23 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.