[libvirt] [PATCH] Inhibit daemon shutdown during driver initialization

Daniel P. Berrange berrange at redhat.com
Thu Dec 6 15:51:43 UTC 2012


On Thu, Dec 06, 2012 at 04:47:18PM +0100, Guido Günther wrote:
> As of 1a50ba2cb07d8bb2aa724062889deb9efd7ad9e9 qemu capabilities probing
> takes longer since we timeout waiting for the monitor socket. When
> probing qemu for different architectures this can add up so the daemon
> auto shutdown timeout is reached and the client doesn't have a chance
> to connect. To avoid that inhibit daemon shutdown during driver
> initialization (which includes capabilities probing).
> 
> This fixes
> 
> 	http://honk.sigxcpu.org:8001/job/libvirt-tck-debian-wheezy-qemu-session/227/
> ---
>  daemon/libvirtd.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 91b3c11..7acdbdf 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -846,6 +846,10 @@ static void daemonRunStateInit(void *opaque)
>  {
>      virNetServerPtr srv = opaque;
>  
> +    /* Since driver initialization can take time inhibit daemon shutdown until
> +       we're done so clients get a chance to connect */
> +    daemonInhibitCallback(true, srv);
> +
>      /* Start the stateful HV drivers
>       * This is deliberately done after telling the parent process
>       * we're ready, since it can take a long time and this will
> @@ -856,8 +860,7 @@ static void daemonRunStateInit(void *opaque)
>          VIR_ERROR(_("Driver state initialization failed"));
>          /* Ensure the main event loop quits */
>          kill(getpid(), SIGTERM);
> -        virObjectUnref(srv);
> -        return;
> +        goto out;
>      }
>  
>  #ifdef HAVE_DBUS
> @@ -879,9 +882,10 @@ static void daemonRunStateInit(void *opaque)
>          }
>      }
>  #endif
> -
>      /* Only now accept clients from network */
>      virNetServerUpdateServices(srv, true);
> +out:
> +    daemonInhibitCallback(false, srv);
>      virObjectUnref(srv);
>  }

ACK, if you rename the goto label 'out' to 'cleanup' to follow more
common naming convention

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list