[fence-virt/f16: 1/2] * Fri Nov 02 2012 Ryan McCabe <rmccabe at redhat.com> - 0.3.0-3 - Return success for the off operation
Ryan McCabe
rmccabe at fedoraproject.org
Fri Nov 2 16:20:49 UTC 2012
commit be55c66b1d4840d15b11be61e887d7eb0b340fd0
Author: Ryan McCabe <rmccabe at redhat.com>
Date: Fri Nov 2 12:18:45 2012 -0400
* Fri Nov 02 2012 Ryan McCabe <rmccabe at redhat.com> - 0.3.0-3
- Return success for the off operation if a domain exists
but is already off.
Return-success-if-a-domain-exists-but-is-off.patch | 126 ++++++++++++++++++++
fence-virt.spec | 8 +-
2 files changed, 133 insertions(+), 1 deletions(-)
---
diff --git a/Return-success-if-a-domain-exists-but-is-off.patch b/Return-success-if-a-domain-exists-but-is-off.patch
new file mode 100644
index 0000000..6665089
--- /dev/null
+++ b/Return-success-if-a-domain-exists-but-is-off.patch
@@ -0,0 +1,126 @@
+From 0de5dd3ac988386085c2cb600e8d122974ab3981 Mon Sep 17 00:00:00 2001
+From: Ryan McCabe <rmccabe at redhat.com>
+Date: Fri, 26 Oct 2012 18:14:45 -0400
+Subject: [PATCH] fence_virtd: Return success if a domain exists but is
+ already off.
+
+Return success if a domain exists but is already off.
+
+Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
+---
+ server/checkpoint.c | 27 +++++++++++++++++----------
+ server/libvirt.c | 28 ++++++++++++++++++----------
+ 2 files changed, 35 insertions(+), 20 deletions(-)
+
+diff --git a/server/checkpoint.c b/server/checkpoint.c
+index 3ac7e6b..edf7728 100644
+--- a/server/checkpoint.c
++++ b/server/checkpoint.c
+@@ -386,16 +386,18 @@ do_off(const char *vm_name)
+ vdp = virDomainLookupByName(vp, vm_name);
+ }
+
+- if (!vdp ||
+- ((virDomainGetInfo(vdp, &vdi) == 0) &&
+- (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ if (!vdp) {
+ dbg_printf(2, "Nothing to do - domain does not exist\n");
+-
+- if (vdp)
+- virDomainFree(vdp);
+ return 1;
+ }
+
++ if (((virDomainGetInfo(vdp, &vdi) == 0) &&
++ (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ dbg_printf(2, "Nothing to do - domain is off\n");
++ virDomainFree(vdp);
++ return 0;
++ }
++
+ syslog(LOG_NOTICE, "Destroying domain %s\n", vm_name);
+ dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
+ ret = virDomainDestroy(vdp);
+@@ -446,15 +448,20 @@ do_reboot(const char *vm_name)
+ vdp = virDomainLookupByName(vp, vm_name);
+ }
+
+- if (!vdp || ((virDomainGetInfo(vdp, &vdi) == 0) &&
+- (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ if (!vdp) {
+ dbg_printf(2, "[libvirt:REBOOT] Nothing to "
+ "do - domain does not exist\n");
+- if (vdp)
+- virDomainFree(vdp);
+ return 1;
+ }
+
++ if (((virDomainGetInfo(vdp, &vdi) == 0) &&
++ (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ dbg_printf(2, "[libvirt:REBOOT] Nothing to "
++ "do - domain is off\n");
++ virDomainFree(vdp);
++ return 0;
++ }
++
+ syslog(LOG_NOTICE, "Rebooting domain %s\n", vm_name);
+ printf("Rebooting domain %s...\n", vm_name);
+ domain_desc = virDomainGetXMLDesc(vdp, 0);
+diff --git a/server/libvirt.c b/server/libvirt.c
+index 12bb8ad..1d1473b 100644
+--- a/server/libvirt.c
++++ b/server/libvirt.c
+@@ -171,16 +171,18 @@ libvirt_off(const char *vm_name, const char *src,
+ vdp = virDomainLookupByName(info->vp, vm_name);
+ }
+
+- if (!vdp ||
+- ((virDomainGetInfo(vdp, &vdi) == 0) &&
+- (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ if (!vdp) {
+ dbg_printf(2, "Nothing to do - domain does not exist\n");
+-
+- if (vdp)
+- virDomainFree(vdp);
+ return 1;
+ }
+
++ if (((virDomainGetInfo(vdp, &vdi) == 0) &&
++ (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ dbg_printf(2, "Nothing to do - domain is off\n");
++ virDomainFree(vdp);
++ return 0;
++ }
++
+ syslog(LOG_NOTICE, "Destroying domain %s\n", vm_name);
+ dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
+ ret = virDomainDestroy(vdp);
+@@ -314,15 +316,21 @@ libvirt_reboot(const char *vm_name, const char *src,
+ vdp = virDomainLookupByName(info->vp, vm_name);
+ }
+
+- if (!vdp || ((virDomainGetInfo(vdp, &vdi) == 0) &&
+- (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ if (!vdp) {
+ dbg_printf(2, "[libvirt:REBOOT] Nothing to "
+ "do - domain does not exist\n");
+- if (vdp)
+- virDomainFree(vdp);
+ return 1;
+ }
+
++ if (((virDomainGetInfo(vdp, &vdi) == 0) &&
++ (vdi.state == VIR_DOMAIN_SHUTOFF))) {
++ dbg_printf(2, "[libvirt:REBOOT] Nothing to "
++ "do - domain is off\n");
++ virDomainFree(vdp);
++ return 0;
++ }
++
++
+ syslog(LOG_NOTICE, "Rebooting domain %s\n", vm_name);
+ printf("Rebooting domain %s...\n", vm_name);
+ domain_desc = virDomainGetXMLDesc(vdp, 0);
+--
+1.7.11.7
+
diff --git a/fence-virt.spec b/fence-virt.spec
index 4d82849..dce5a52 100644
--- a/fence-virt.spec
+++ b/fence-virt.spec
@@ -1,6 +1,6 @@
Name: fence-virt
Version: 0.3.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: A pluggable fencing framework for virtual machines
Group: System Environment/Base
License: GPLv2+
@@ -11,6 +11,7 @@ Patch1: add-a-delay-w-option.patch
Patch2: Improve-fence_virt.conf-man-page-description-of-hash.patch
Patch3: Return-failure-for-nonexistent-domains.patch
Patch4: Fix-typo-in-fence_virt-8-man-page.patch
+Patch5: Return-success-if-a-domain-exists-but-is-off.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@@ -93,6 +94,7 @@ to track VMs across multiple hosts.
%patch2 -p1 -b .Improve-fence_virt.conf-man-page-description-of-hash
%patch3 -p1 -b .Return-failure-for-nonexistent-domains
%patch4 -p1 -b .Fix-typo-in-fence_virt-8-man-page
+%patch5 -p1 -b .Return-success-if-a-domain-exists-but-is-off
%build
@@ -182,6 +184,10 @@ fi
%changelog
+* Fri Nov 02 2012 Ryan McCabe <rmccabe at redhat.com> - 0.3.0-3
+- Return success for the off operation if a domain exists
+ but is already off.
+
* Mon Oct 15 2012 Ryan McCabe <rmccabe at redhat.com> - 0.3.0-2
- Add a -w (delay) option.
- Return failure when attempting to fence a nonexistent domain
More information about the scm-commits
mailing list