]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix daemon auto-spawning
authorChristophe Fergeau <cfergeau@redhat.com>
Thu, 12 Jul 2012 11:52:36 +0000 (13:52 +0200)
committerChristophe Fergeau <cfergeau@redhat.com>
Thu, 12 Jul 2012 11:52:36 +0000 (13:52 +0200)
commitefe6c8021146d046846ead5b5efc9828d97c1ceb
treefdf673dea93d6361267590f7b696772db3fc04c1
parent1ffc78b54bd67da2e1111ac94ddc35c4658072c3
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