Fix libvirtd SIGHUP handler

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=141
This commit is contained in:
James Fehlig 2011-08-18 21:11:13 +00:00 committed by Git OBS Bridge
parent 4cafa05b40
commit 785bf3956a
4 changed files with 58 additions and 4 deletions

View File

@ -0,0 +1,46 @@
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;
}

View File

@ -1,8 +1,8 @@
Index: libvirt-0.9.3/examples/apparmor/Makefile.am
Index: libvirt-0.9.4/examples/apparmor/Makefile.am
===================================================================
--- libvirt-0.9.3.orig/examples/apparmor/Makefile.am
+++ libvirt-0.9.3/examples/apparmor/Makefile.am
@@ -3,3 +3,12 @@ EXTRA_DIST= \
--- libvirt-0.9.4.orig/examples/apparmor/Makefile.am
+++ libvirt-0.9.4/examples/apparmor/Makefile.am
@@ -6,3 +6,12 @@ EXTRA_DIST= \
libvirt-qemu \
usr.lib.libvirt.virt-aa-helper \
usr.sbin.libvirtd

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Aug 17 16:24:17 MDT 2011 - jfehlig@suse.com
- Fix libvirtd SIGHUP handler
9e093f0b-libvirtd-sighup.patch
-------------------------------------------------------------------
Mon Aug 8 15:21:42 MDT 2011 - jfehlig@suse.com

View File

@ -360,6 +360,7 @@ Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
Source2: libvirtd-relocation-server.fw
# Upstream patches
Patch0: 9e093f0b-libvirtd-sighup.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch101: clone.patch
@ -478,6 +479,7 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch100 -p1
%patch101
%patch102 -p1