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. v2: - Do not introduce unused functions v1: - https://lists.libvirt.org/archives/list/devel@xxxxxxxxxxxxxxxxx/thread/H57G6LAUI6VQ2GQEBSXMQ3JZU34F47Q4/ Martin Kletzander (8): qemu: Move domain-related functions to qemu_domain qemu: Change parameters of qemuGetMemoryBackingDomainPath() qemu: Add memoryBackingDir to qemuDomainObjPrivate qemu: Set memoryBackingDir in private data upon start qemu: Use per-domain private memoryBackingDir for new memory backends qemu: Make qemuGetMemoryBackingDomainPath static qemu: Rename memory path functions qemu: Generate domain memory backing path directly src/qemu/qemu_command.c | 5 +- src/qemu/qemu_conf.c | 58 --------------- src/qemu/qemu_conf.h | 8 -- src/qemu/qemu_domain.c | 73 ++++++++++++++++++- src/qemu/qemu_domain.h | 7 ++ src/qemu/qemu_hotplug.c | 4 +- src/qemu/qemu_process.c | 13 ++-- 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, 163 insertions(+), 83 deletions(-) create mode 100644 tests/qemustatusxml2xmldata/memory-backing-dir-in.xml create mode 120000 tests/qemustatusxml2xmldata/memory-backing-dir-out.xml -- 2.46.1