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

Andrea Bolognani abologna at redhat.com
Fri Mar 12 10:42:22 UTC 2021


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?

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list