aboutsummaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2011-07-21 18:23:21 +0100
committerDaniel P. Berrange <berrange@redhat.com>2011-07-22 11:39:39 +0100
commit92509413e2da3260b99177de82c85a59cf8ddfd9 (patch)
tree6625b7fcb82a19169d376d8bb8ec506e3a925c97 /daemon
parentAsynchronous event for BlockJob completion (diff)
downloadlibvirt-92509413e2da3260b99177de82c85a59cf8ddfd9.tar.gz
libvirt-92509413e2da3260b99177de82c85a59cf8ddfd9.tar.bz2
libvirt-92509413e2da3260b99177de82c85a59cf8ddfd9.zip
Ensure that libvirtd shuts down if initialization fails
If the virStateInitialize call fails we must shutdown libvirtd since drivers will not be available. Just free'ing the virNetServer is not sufficient, we must send a SIGTERM to ourselves so that we interrupt the event loop and trigger a orderly shutdown * daemon/libvirtd.c: Kill ourselves if state init fails * src/rpc/virnetserver.c: Add some debugging to event loop
Diffstat (limited to 'daemon')
-rw-r--r--daemon/libvirtd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 38876d84d..f2f3a4eaf 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1156,6 +1156,8 @@ static void daemonRunStateInit(void *opaque)
* seriously delay OS bootup process */
if (virStateInitialize(virNetServerIsPrivileged(srv)) < 0) {
VIR_ERROR(_("Driver state initialization failed"));
+ /* Ensure the main event loop quits */
+ kill(getpid(), SIGTERM);
virNetServerFree(srv);
return;
}