From 98e332e2432c9cf559cd55e3ff8489f658328021 Mon Sep 17 00:00:00 2001
From: Ryan McCabe <rmccabe@redhat.com>
Date: Mon, 8 Oct 2012 10:53:13 -0400
Subject: [PATCH] fence_virt: Return failure for nonexistent domains
Return failure instead of success if a user attempts an operation
on a domain that does not exist.
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
server/checkpoint.c | 4 ++--
server/libvirt.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/checkpoint.c b/server/checkpoint.c
index 408003f..3ac7e6b 100644
--- a/server/checkpoint.c
+++ b/server/checkpoint.c
@@ -393,7 +393,7 @@ do_off(const char *vm_name)
if (vdp)
virDomainFree(vdp);
- return 0;
+ return 1;
}
syslog(LOG_NOTICE, "Destroying domain %s\n", vm_name);
@@ -452,7 +452,7 @@ do_reboot(const char *vm_name)
"do - domain does not exist\n");
if (vdp)
virDomainFree(vdp);
- return 0;
+ return 1;
}
syslog(LOG_NOTICE, "Rebooting domain %s\n", vm_name);
diff --git a/server/libvirt.c b/server/libvirt.c
index ac93f18..12bb8ad 100644
--- a/server/libvirt.c
+++ b/server/libvirt.c
@@ -178,7 +178,7 @@ libvirt_off(const char *vm_name, const char *src,
if (vdp)
virDomainFree(vdp);
- return 0;
+ return 1;
}
syslog(LOG_NOTICE, "Destroying domain %s\n", vm_name);
@@ -320,7 +320,7 @@ libvirt_reboot(const char *vm_name, const char *src,
"do - domain does not exist\n");
if (vdp)
virDomainFree(vdp);
- return 0;
+ return 1;
}
syslog(LOG_NOTICE, "Rebooting domain %s\n", vm_name);
--
1.7.11.7