[PATCH 1/4] qemu_shim: Don't hang if failed to start domain

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

 



The qemu shim spawns a separate thread in which the event loop is
ran. The virEventRunDefaultImpl() call is wrapped in a while()
loop, just like it should. There are few lines of code around
which try to ensure that domain is destroyed (when quitting) and
that the last round of event loop is ran after the
virDomainDestroy() call. Only after that the loop is quit from
and the thread quits. Well, if creating the domain failed then
the thread is stuck inside event loop forever.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1920337
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_shim.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_shim.c b/src/qemu/qemu_shim.c
index c10598df4b..21a24abade 100644
--- a/src/qemu/qemu_shim.c
+++ b/src/qemu/qemu_shim.c
@@ -45,9 +45,12 @@ qemuShimEventLoop(void *opaque G_GNUC_UNUSED)
     while (!quit) {
         g_mutex_lock(&eventLock);
         if (eventQuitFlag && !eventPreventQuitFlag) {
+            quit = true;
             if (dom) {
                 virDomainDestroy(dom);
-                quit = true;
+            } else {
+                g_mutex_unlock(&eventLock);
+                break;
             }
         }
         g_mutex_unlock(&eventLock);
-- 
2.26.2




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

  Powered by Linux