Hi On Tue, Feb 25, 2020 at 12:24 PM Michal Privoznik <mpriv...@redhat.com> wrote: > > On 2/24/20 4:57 PM, Marc-André Lureau wrote: > > Hi > > > > On Thu, Feb 20, 2020 at 10:04 AM Michal Privoznik <mpriv...@redhat.com> > > wrote: > >> > >> On 1/14/20 2:46 PM, marcandre.lur...@redhat.com wrote: > >>> From: Marc-André Lureau <marcandre.lur...@redhat.com> > >>> > >>> Location of DBus daemon state configuration, socket, pid... > >>> > >>> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > >>> --- > >>> src/qemu/qemu_conf.c | 4 ++++ > >>> src/qemu/qemu_conf.h | 1 + > >>> 2 files changed, 5 insertions(+) > >>> > >>> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c > >>> index e1fea390c7..ade12dac6c 100644 > >>> --- a/src/qemu/qemu_conf.c > >>> +++ b/src/qemu/qemu_conf.c > >>> @@ -144,6 +144,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool > >>> privileged) > >>> > >>> cfg->cacheDir = g_strdup_printf("%s/cache/libvirt/qemu", > >>> LOCALSTATEDIR); > >>> > >>> + cfg->dbusStateDir = g_strdup_printf("%s/run/libvirt/qemu/dbus", > >>> LOCALSTATEDIR); > >>> + > >>> cfg->libDir = g_strdup_printf("%s/lib/libvirt/qemu", > >>> LOCALSTATEDIR); > >>> cfg->saveDir = g_strdup_printf("%s/save", cfg->libDir); > >>> cfg->snapshotDir = g_strdup_printf("%s/snapshot", cfg->libDir); > >>> @@ -174,6 +176,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool > >>> privileged) > >>> cfg->stateDir = g_strdup_printf("%s/qemu/run", rundir); > >>> > >>> cfg->swtpmStateDir = g_strdup_printf("%s/swtpm", > >>> cfg->stateDir); > >>> + cfg->dbusStateDir = g_strdup_printf("%s/dbus", cfg->stateDir); > >>> > >>> cfg->configBaseDir = virGetUserConfigDirectory(); > >> > >> Instead of doing practically the same in two branches, you can achieve > >> the same result with just one line if you put the call just below > >> cfg->slirpStateDir init. > >> > >> However, do we need this to be in a special directory instead of per VM > >> private directory? The way I implemented PR helper was that the socket > >> it creates and to which qemu connects is stored under vm->priv->libDir > >> which is initialized in qemuDomainSetPrivatePaths() to: > >> > >> $cfg->libDir/domain-$shortName/ > >> > >> This way you wouldn't need to care about domain's shortname in the next > >> patch. > > > > Makes sense. I think I based this on slirpStateDir code. Any reason > > it's not using vm->priv->libdir too? > > > > I don't know. But since there are some releases which would store data > under slirpStateDir I don't think we can change this. On daemon restart > (with newer version) the new libvirtd wouldn't see the old dir.
Actually, $cfg->libDir is virQEMUDriverConfigNew () cfg->configBaseDir/qemu/lib, so it ends up under ~/.config for users, and /etc for priviledged/root. A bad place to store transient runtime data/sockets. You may want to reconsider the paths for pr-helper. I don't intend to change that, so you could take a look at "[libvirt PATCH v2 0/9]".