于 2011年08月15日 15:39, Jiri Denemark 写道:
On Mon, Aug 15, 2011 at 15:50:46 +0800, Osier Yang wrote:
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)
---
daemon/libvirtd.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index b866a01..3e0159b 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"));
This message shouldn't be translated. We only translate VIR_ERROR messages.
Make syntax-check would fail because of this.
+ 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;
}
ACK with _() removed from VIR_INFO.
Jirka
Thanks, I pushed with the change.
Osier
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list