On Thu, Jul 12, 2012 at 02:09:33PM +0200, Christophe Fergeau wrote: > 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. Agreed, we can always revisit this decision later if find we need more general passing of these vars. > --- > 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); ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list