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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]