From 785bf3956a453189e557fc75cd4189a0faae7e53ffe19c7bdd3f660f76dc0838 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Thu, 18 Aug 2011 21:11:13 +0000 Subject: [PATCH] Fix libvirtd SIGHUP handler OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=141 --- 9e093f0b-libvirtd-sighup.patch | 46 +++++++++++++++++++++++++++++++++ install-apparmor-profiles.patch | 8 +++--- libvirt.changes | 6 +++++ libvirt.spec | 2 ++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 9e093f0b-libvirtd-sighup.patch diff --git a/9e093f0b-libvirtd-sighup.patch b/9e093f0b-libvirtd-sighup.patch new file mode 100644 index 0000000..9cae09e --- /dev/null +++ b/9e093f0b-libvirtd-sighup.patch @@ -0,0 +1,46 @@ +commit 9e093f0b4cc5a5fc455a4893d73dc0f2c5355161 +Author: Osier Yang +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; + } + diff --git a/install-apparmor-profiles.patch b/install-apparmor-profiles.patch index b5b474e..a5a1a21 100644 --- a/install-apparmor-profiles.patch +++ b/install-apparmor-profiles.patch @@ -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 diff --git a/libvirt.changes b/libvirt.changes index 8af59d4..b1ae8d8 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -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 diff --git a/libvirt.spec b/libvirt.spec index 0d3cc31..e0a6820 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -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