
On 05/17/2010 11:17 AM, Cole Robinson wrote:
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@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,
Just comments and a debug statement, so no damage done; and the added comments make the code easier to read. ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org