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

Guannan Ren gren at redhat.com
Fri May 17 14:31:51 UTC 2013


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..a569406 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);
+    virReportSystemError(EBUSY,
+                         _("Failed to terminate process %lld with SIG%s"),
+                         (long long)pid, signame);
 
 cleanup:
     return ret;
-- 
1.8.1.4




More information about the libvir-list mailing list