Re: [PATCH] qemu: report useful error failling to destroy domain gracefully

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

 



On Fri, May 17, 2013 at 05:32:06PM +0800, Guannan Ren wrote:
> Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=927620
> 
>  #kill -STOP `pidof qemu-kvm`
>  #virsh destroy $guest --graceful
>  error: Failed to destroy domain testVM
>  error: An error occurred, but the cause is unknown
> 
> With --graceful, SIGTERM always is emitted to kill driver
> process, but it won't success till burning out waiting time
> in case of process being stopped.
> But domain destroy without --graceful can work, SIGKILL will
> be emitted to the stopped process after 10 secs which always
> kills a process even one that is currently stopped.
> So report an error after burning out waiting time in this case.
> ---
>  src/qemu/qemu_process.c | 2 +-
>  src/util/virprocess.c   | 5 +++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 4a7c612..e5b4679 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3930,7 +3930,7 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
>          }
>      }
>  
> -    if ((flags & VIR_QEMU_PROCESS_KILL_NOWAIT)) {
> +    if (flags & VIR_QEMU_PROCESS_KILL_NOWAIT) {
>          virProcessKill(vm->pid,
>                         (flags & VIR_QEMU_PROCESS_KILL_FORCE) ?
>                         SIGKILL : SIGTERM);
> diff --git a/src/util/virprocess.c b/src/util/virprocess.c
> index 99db003..a79ed05 100644
> --- a/src/util/virprocess.c
> +++ b/src/util/virprocess.c
> @@ -310,8 +310,9 @@ virProcessKillPainfully(pid_t pid, bool force)
>          usleep(200 * 1000);
>      }
>  
> -    VIR_DEBUG("Timed out waiting after SIGKILL to process %lld",
> -              (long long)pid);
> +    virReportError(VIR_ERR_OPERATION_INVALID,
> +                   _("Failed to terminate process %lld with SIG%s"),
> +                   (long long)pid, signame);

OPERATION_INVALID isn't really appropriate for this. I'd raise a
system error, using  errno==EBUSY to indicate that it needs to
be re-tried to kill the process

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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