Every time we work with file-backed memory we construct the paths from the driver config. Not only does is that slow, it is also wrong. If the configuration changes while a domain with file-backed memory is running, once the daemon is restarted and the domain is being stopped, we construct the wrong path to clean up. And it also makes it more difficult to change that in the future, for example the patch series which led me to write this patch series: https://lists.libvirt.org/archives/list/devel@xxxxxxxxxxxxxxxxx/message/I6VOQL453JKGKTWVERW5RSBILCKRBEEU/ The patches are maybe split way too much, so feel free to suggest squashing some together, I'm not opposed to that. Martin Kletzander (8): qemu: Move domain-related functions to qemu_domain qemu_domain.h: Change indentation for new functions qemu: Change parameters of qemuGetMemoryBackingDomainPath() qemu_domain: Add memoryBackingDir to qemuDomainObjPrivate qemu_domain: Add qemuDomainSetPrivateMemPath() qemu_domain: Set memoryBackingDir in private data upon start qemu: Use per-domain private memoryBackingDir for new memory backends qemu_domain: Remove unused qemuGetMemoryBackingDomainPath() src/qemu/qemu_command.c | 4 +- src/qemu/qemu_conf.c | 58 --------------- src/qemu/qemu_conf.h | 8 -- src/qemu/qemu_domain.c | 74 ++++++++++++++++++- src/qemu/qemu_domain.h | 11 +++ src/qemu/qemu_hotplug.c | 4 +- src/qemu/qemu_process.c | 12 +-- src/qemu/qemu_process.h | 3 +- .../qemustatusxml2xmldata/backup-pull-in.xml | 1 + .../blockjob-blockdev-in.xml | 1 + .../blockjob-mirror-in.xml | 1 + .../memory-backing-dir-in.xml | 61 +++++++++++++++ .../memory-backing-dir-out.xml | 1 + .../migration-in-params-in.xml | 1 + .../migration-out-nbd-bitmaps-in.xml | 1 + .../migration-out-nbd-out.xml | 1 + .../migration-out-nbd-tls-out.xml | 1 + .../migration-out-params-in.xml | 1 + tests/qemustatusxml2xmldata/modern-in.xml | 1 + tests/qemustatusxml2xmldata/upgrade-out.xml | 1 + .../qemustatusxml2xmldata/vcpus-multi-in.xml | 1 + tests/qemuxmlactivetest.c | 2 + 22 files changed, 167 insertions(+), 82 deletions(-) create mode 100644 tests/qemustatusxml2xmldata/memory-backing-dir-in.xml create mode 120000 tests/qemustatusxml2xmldata/memory-backing-dir-out.xml -- 2.46.0