47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
|
commit 9e093f0b4cc5a5fc455a4893d73dc0f2c5355161
|
||
|
Author: Osier Yang <jyang@redhat.com>
|
||
|
Date: Mon Aug 15 15:40:46 2011 +0800
|
||
|
|
||
|
daemon: Fix regression of libvirtd reloading support
|
||
|
|
||
|
This is introduced by commit df0b57a95a, which forgot to
|
||
|
add signal handler for SIGHUP.
|
||
|
|
||
|
A simple reproduce method:
|
||
|
|
||
|
1) Create a domain XML under /etc/libvirt/qemu
|
||
|
2) % kill -SIGHUP $(pidof libvirtd)
|
||
|
3) % virsh list --all (the new created domain XML is not listed)
|
||
|
|
||
|
Index: libvirt-0.9.4/daemon/libvirtd.c
|
||
|
===================================================================
|
||
|
--- libvirt-0.9.4.orig/daemon/libvirtd.c
|
||
|
+++ libvirt-0.9.4/daemon/libvirtd.c
|
||
|
@@ -1139,6 +1139,17 @@ static void daemonShutdownHandler(virNet
|
||
|
virNetServerQuit(srv);
|
||
|
}
|
||
|
|
||
|
+static void daemonReloadHandler(virNetServerPtr srv ATTRIBUTE_UNUSED,
|
||
|
+ siginfo_t *sig ATTRIBUTE_UNUSED,
|
||
|
+ void *opaque ATTRIBUTE_UNUSED)
|
||
|
+{
|
||
|
+ VIR_INFO("Reloading configuration on SIGHUP");
|
||
|
+ virHookCall(VIR_HOOK_DRIVER_DAEMON, "-",
|
||
|
+ VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL);
|
||
|
+ if (virStateReload() < 0)
|
||
|
+ VIR_WARN("Error while reloading drivers");
|
||
|
+}
|
||
|
+
|
||
|
static int daemonSetupSignals(virNetServerPtr srv)
|
||
|
{
|
||
|
if (virNetServerAddSignalHandler(srv, SIGINT, daemonShutdownHandler, NULL) < 0)
|
||
|
@@ -1147,6 +1158,8 @@ static int daemonSetupSignals(virNetServ
|
||
|
return -1;
|
||
|
if (virNetServerAddSignalHandler(srv, SIGTERM, daemonShutdownHandler, NULL) < 0)
|
||
|
return -1;
|
||
|
+ if (virNetServerAddSignalHandler(srv, SIGHUP, daemonReloadHandler, NULL) < 0)
|
||
|
+ return -1;
|
||
|
return 0;
|
||
|
}
|
||
|
|