]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Don't deny ShutdownVMDaemon for non-running VMs
authorCole Robinson <crobinso@redhat.com>
Mon, 17 May 2010 16:48:47 +0000 (12:48 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 20 May 2010 15:45:20 +0000 (11:45 -0400)
Clients that require this already seem to do so. Calling this function
with pid < 1 also should not cause problems.

src/qemu/qemu_driver.c

index 7abf5a00a211e71ff80e5c24ba0f6262b2ee1f0c..d387e694af531c1fa0ecf4d908dddb623f30a998 100644 (file)
@@ -3604,10 +3604,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. */
@@ -3630,6 +3628,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,