[PATCH 3/8] qemu-conf: add dbusStateDir

Michal Privoznik mprivozn at redhat.com
Thu Feb 20 09:04:18 UTC 2020


On 1/14/20 2:46 PM, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> Location of DBus daemon state configuration, socket, pid...
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at 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.

Michal




More information about the libvir-list mailing list