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

Eric Blake eblake at redhat.com
Tue May 18 16:27:29 UTC 2010


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 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,

Just comments and a debug statement, so no damage done; and the added
comments make the code easier to read.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100518/d1a9fac3/attachment-0001.sig>


More information about the libvir-list mailing list