]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_shim: Don't hang if failed to start domain
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 25 Feb 2021 14:01:27 +0000 (15:01 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 12 Mar 2021 16:05:52 +0000 (17:05 +0100)
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.

However, if domain creation fails, there is no @dom to call
destroy over, the @quit flag is never set and while() never
exits. Set the flag regardless of @dom pointer.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1920337
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_shim.c

index d85497bd3ab85e5b35cd2eb745e752c7368cb850..8b3afd0324d3799bd52444b57dd95ad695231006 100644 (file)
@@ -45,9 +45,9 @@ qemuShimEventLoop(void *opaque G_GNUC_UNUSED)
     while (!quit) {
         g_mutex_lock(&eventLock);
         if (eventQuitFlag && !eventPreventQuitFlag) {
+            quit = true;
             if (dom) {
                 virDomainDestroy(dom);
-                quit = true;
             }
         }
         g_mutex_unlock(&eventLock);