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

 



On 3/12/21 11:42 AM, Andrea Bolognani wrote:
On Mon, 2021-03-01 at 12:49 +0100, Michal Privoznik wrote:
+++ 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);

I'm probably missing something obvious, but I thought this could be
simply

   while (!quit) {
       g_mutex_lock(&eventLock);
       if (eventQuitFlag && !eventPreventQuitFlag) {
           quit = true;
           if (dom) {
               virDomainDestroy(dom);
           }
       }
       g_mutex_unlock(&eventLock);
       virEventRunDefaultImpl();
   }

Do we specifically want to avoid call virEventRunDefaultImpl() one
last time if the domain has failed to start?


Huh, riddle me this - how come now this is sufficient, but back then when I was writing this it wasn't?

diff --git i/src/qemu/qemu_shim.c w/src/qemu/qemu_shim.c
index c10598df4b..5a9ffdd416 100644
--- i/src/qemu/qemu_shim.c
+++ w/src/qemu/qemu_shim.c
@@ -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);

Will post it as v2, soon.

Michal




[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