qemu: Move channelTargetDir into stateDir

For historical reasons (i.e. unknown reason) we put channel
sockets into a path derived from cfg->libDir which is a path that
survives host reboots (e.g. /var/lib/libvirt/...). This is not
necessary and in fact for session daemon creates a longer prefix:

  XDG_CONFIG_HOME -> /home/user/.config
  XDG_RUNTIME_DIR -> /run/user/1000

Worse, if host is rebooted suddenly (e.g. due to power loss) then
we leave files behind and nobody will ever remove them.

Therefore, place the channel target dir into state dir.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2173980
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Michal Privoznik
2023-04-20 10:16:43 +02:00
parent d3759d3674
commit 8abc979bb0
10 changed files with 69 additions and 18 deletions

View File

@@ -460,7 +460,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
VIR_FREE(cfg->libDir);
cfg->libDir = g_strdup("/var/lib/libvirt/qemu");
VIR_FREE(cfg->channelTargetDir);
cfg->channelTargetDir = g_strdup("/var/lib/libvirt/qemu/channel");
cfg->channelTargetDir = g_strdup("/var/run/libvirt/qemu/channel");
VIR_FREE(cfg->memoryBackingDir);
cfg->memoryBackingDir = g_strdup("/var/lib/libvirt/qemu/ram");
VIR_FREE(cfg->nvramDir);