[libvirt] [PATCH 3/4] qemu: Don't deny ShutdownVMDaemon for non-running VMs

Cole Robinson crobinso at redhat.com
Mon May 17 17:17:04 UTC 2010


Clients that require this already seem to do so. Calling this function
with pid < 1 also should not cause problems.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/qemu/qemu_driver.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61aacfb..d2f1a36 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3608,10 +3608,8 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver,
     virDomainDefPtr def;
     int i;
 
-    if (!virDomainObjIsActive(vm))
-        return;
-
-    VIR_DEBUG("Shutting down VM '%s' migrated=%d", vm->def->name, migrated);
+    VIR_DEBUG("Shutting down VM '%s' pid=%d migrated=%d",
+              vm->def->name, vm->pid, migrated);
 
     /* This method is routinely used in clean up paths. Disable error
      * reporting so we don't squash a legit error. */
@@ -3634,6 +3632,7 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver,
         }
     }
 
+    /* This will safely handle a non-running guest with pid=0 or pid=-1*/
     if (virKillProcess(vm->pid, 0) == 0 &&
         virKillProcess(vm->pid, SIGTERM) < 0)
         virReportSystemError(errno,
-- 
1.6.6.1




More information about the libvir-list mailing list