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

Ján Tomko jtomko at redhat.com
Sat Feb 29 08:35:39 UTC 2020


On a Friday in 2020, Marc-André Lureau wrote:
>Hi
>
>On Tue, Feb 25, 2020 at 12:24 PM Michal Privoznik <mprivozn at 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 <mprivozn at redhat.com> wrote:
>> >>
>> >> 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.
>> >
>> > 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

For the privileged driver, cfg->libDir is derived from LOCALSTATEDIR,
so it goes in /var.

Using ~/.config for unprivileged libDir does sound like an odd choice,
but if that's so we should fix it for all libDir users, not keep
introducing new Dirs.

Jano

>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]".
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200229/41f9819a/attachment-0001.sig>


More information about the libvir-list mailing list