summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorOsier Yang <jyang@redhat.com>2011-08-15 15:40:46 +0800
committerOsier Yang <jyang@redhat.com>2011-08-15 15:40:46 +0800
commit9e093f0b4cc5a5fc455a4893d73dc0f2c5355161 (patch)
tree6c956f082890b4c7ffbe4abbce56e62df1f18656 /daemon
parent2a48b59dec3bfe8e82dcad5e71180dcee55703e8 (diff)
downloadlibvirt-9e093f0b4cc5a5fc455a4893d73dc0f2c5355161.tar.gz
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)
Diffstat (limited to 'daemon')
-rw-r--r--daemon/libvirtd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index b866a015b0..1a833260fa 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1102,6 +1102,17 @@ static void daemonShutdownHandler(virNetServerPtr srv,
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)
@@ -1110,6 +1121,8 @@ static int daemonSetupSignals(virNetServerPtr srv)
return -1;
if (virNetServerAddSignalHandler(srv, SIGTERM, daemonShutdownHandler, NULL) < 0)
return -1;
+ if (virNetServerAddSignalHandler(srv, SIGHUP, daemonReloadHandler, NULL) < 0)
+ return -1;
return 0;
}