[Cluster-devel] cluster/fence/agents/xvm fence_xvmd.c
lhh at sourceware.org
lhh at sourceware.org
Mon Nov 19 17:28:33 UTC 2007
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");
More information about the Cluster-devel
mailing list