From f4e752a385c921c251f62bc13bef16a6295901af Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 23 Jul 2012 14:05:38 +0100 Subject: [PATCH] Add upstream patch to fix RHBZ#842114. --- 0001-Fix-daemon-auto-spawning.patch | 46 +++++++++++++++++++++++++++++ libvirt.spec | 10 ++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-daemon-auto-spawning.patch diff --git a/0001-Fix-daemon-auto-spawning.patch b/0001-Fix-daemon-auto-spawning.patch new file mode 100644 index 0000000..099676f --- /dev/null +++ b/0001-Fix-daemon-auto-spawning.patch @@ -0,0 +1,46 @@ +From efe6c8021146d046846ead5b5efc9828d97c1ceb Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Thu, 12 Jul 2012 13:52:36 +0200 +Subject: [PATCH] Fix daemon auto-spawning + +Commit 32a9aac switched libvirt to use the XDG base directories +to locate most of its data/config. In particular, the per-user socket +for qemu:///session is now stored in the XDG runtime directory. +This directory is located by looking at the XDG_RUNTIME_DIR environment +variable, with a fallback to ~/.cache/libvirt if this variable is not +set. + +When the daemon is autospawned because a client application wants +to use qemu:///session, the daemon is ran in a clean environment +which does not contain XDG_RUNTIME_DIR. It will create its socket +in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR +set, it will not look for the socket in the fallback place, and will +fail to connect to the autospawned daemon. + +This patch adds XDG_RUNTIME_DIR to the daemon environment before +auto-starting it. I've done this in virNetSocketForkDaemon rather +than in virCommandAddEnvPassCommon as I wasn't sure we want to pass +these variables to other commands libvirt spawns. XDG_CACHE_HOME +and XDG_CONFIG_HOME are also added to the daemon env as it makes use +of those as well. +--- + src/rpc/virnetsocket.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c +index 0b32ffe..08dfbb0 100644 +--- a/src/rpc/virnetsocket.c ++++ b/src/rpc/virnetsocket.c +@@ -97,6 +97,9 @@ static int virNetSocketForkDaemon(const char *binary) + NULL); + + virCommandAddEnvPassCommon(cmd); ++ virCommandAddEnvPass(cmd, "XDG_CACHE_HOME"); ++ virCommandAddEnvPass(cmd, "XDG_CONFIG_HOME"); ++ virCommandAddEnvPass(cmd, "XDG_RUNTIME_DIR"); + virCommandClearCaps(cmd); + virCommandDaemonize(cmd); + ret = virCommandRun(cmd, NULL); +-- +1.7.10.4 + diff --git a/libvirt.spec b/libvirt.spec index 278d499..e2391a2 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -301,7 +301,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 0.9.13 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -312,6 +312,9 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Upstream patch to fix RHBZ#842114. Can be removed in 0.9.14. +Patch0: 0001-Fix-daemon-auto-spawning.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -983,6 +986,8 @@ of recent versions of Linux (and other OSes). %prep %setup -q +%patch0 -p1 + %build %if ! %{with_xen} %define _without_xen --without-xen @@ -1792,6 +1797,9 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %endif %changelog +* Mon Jul 23 2012 Richard W.M. Jones - 0.9.13-3 +- Add upstream patch to fix RHBZ#842114. + * Thu Jul 19 2012 Fedora Release Engineering - 0.9.13-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild