]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Inhibit daemon shutdown during driver initialization
authorGuido Günther <agx@sigxcpu.org>
Wed, 5 Dec 2012 19:21:14 +0000 (20:21 +0100)
committerGuido Günther <agx@sigxcpu.org>
Thu, 6 Dec 2012 19:27:09 +0000 (20:27 +0100)
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

index 91b3c116ef28c91c3fc53009039f2c9460a66c96..f88be9bedda1c02c9303a3f4a4d130146584c69e 100644 (file)
@@ -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 cleanup;
     }
 
 #ifdef HAVE_DBUS
@@ -879,9 +882,10 @@ static void daemonRunStateInit(void *opaque)
         }
     }
 #endif
-
     /* Only now accept clients from network */
     virNetServerUpdateServices(srv, true);
+cleanup:
+    daemonInhibitCallback(false, srv);
     virObjectUnref(srv);
 }