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)
This commit is contained in:
Osier Yang 2011-08-15 15:40:46 +08:00
parent 2a48b59dec
commit 9e093f0b4c

View File

@ -1102,6 +1102,17 @@ static void daemonShutdownHandler(virNetServerPtr srv,
virNetServerQuit(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) static int daemonSetupSignals(virNetServerPtr srv)
{ {
if (virNetServerAddSignalHandler(srv, SIGINT, daemonShutdownHandler, NULL) < 0) if (virNetServerAddSignalHandler(srv, SIGINT, daemonShutdownHandler, NULL) < 0)
@ -1110,6 +1121,8 @@ static int daemonSetupSignals(virNetServerPtr srv)
return -1; return -1;
if (virNetServerAddSignalHandler(srv, SIGTERM, daemonShutdownHandler, NULL) < 0) if (virNetServerAddSignalHandler(srv, SIGTERM, daemonShutdownHandler, NULL) < 0)
return -1; return -1;
if (virNetServerAddSignalHandler(srv, SIGHUP, daemonReloadHandler, NULL) < 0)
return -1;
return 0; return 0;
} }