This way we keep the path for each running VM. Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 17 +++++++++++++++-- tests/qemustatusxml2xmldata/backup-pull-in.xml | 1 + .../blockjob-blockdev-in.xml | 1 + .../blockjob-mirror-in.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 + tests/qemustatusxml2xmldata/vcpus-multi-in.xml | 1 + 12 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 76bcb70a5699..b05b1c9647a8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1795,7 +1795,7 @@ qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, /* This is the old way of setting up per-domain directories */ -static void +static int qemuDomainSetPrivatePathsOld(virQEMUDriver *driver, virDomainObj *vm) { @@ -1808,6 +1808,13 @@ qemuDomainSetPrivatePathsOld(virQEMUDriver *driver, if (!priv->channelTargetDir) priv->channelTargetDir = g_strdup_printf("%s/domain-%s", cfg->channelTargetDir, vm->def->name); + + if (!priv->memoryBackingDir && + qemuGetMemoryBackingDomainPath(priv, vm->def, + &priv->memoryBackingDir) < 0) + return -1; + + return 0; } @@ -1829,6 +1836,11 @@ qemuDomainSetPrivatePaths(virQEMUDriver *driver, priv->channelTargetDir = g_strdup_printf("%s/%s", cfg->channelTargetDir, domname); + if (!priv->memoryBackingDir && + qemuGetMemoryBackingDomainPath(priv, vm->def, + &priv->memoryBackingDir) < 0) + return -1; + return 0; } @@ -3434,7 +3446,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, priv->memoryBackingDir = virXPathString("string(./memoryBackingDir/@path)", ctxt); - qemuDomainSetPrivatePathsOld(driver, vm); + if (qemuDomainSetPrivatePathsOld(driver, vm) < 0) + return -1; if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU, false) < 0) diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemustatusxml2xmldata/backup-pull-in.xml index e7fdc6c47832..2cedcc3cf227 100644 --- a/tests/qemustatusxml2xmldata/backup-pull-in.xml +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -231,6 +231,7 @@ </devices> <libDir path='/var/lib/libvirt/qemu/domain-4-copy'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-copy'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/4-copy'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml index 380ef053d2b8..1c45fad370c4 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -230,6 +230,7 @@ </devices> <libDir path='/var/lib/libvirt/qemu/domain-4-copy'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-copy'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/4-copy'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml index 1bcdeffcb876..df11e83cedb5 100644 --- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml @@ -21,6 +21,7 @@ <numad nodeset='0-2' cpuset='1,3'/> <libDir path='/tmp'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/1-QEMUGuest1'/> <allowReboot value='yes'/> <nodename index='0'/> <fdset index='0'/> diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests/qemustatusxml2xmldata/migration-in-params-in.xml index 03773a089b3a..861d8eeadb92 100644 --- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml @@ -254,6 +254,7 @@ </job> <libDir path='/var/lib/libvirt/qemu/domain-1-nest'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-1-nest'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/1-nest'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml index 4ee44ffbd480..5d76545513cc 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml @@ -320,6 +320,7 @@ </devices> <libDir path='/var/lib/libvirt/qemu/domain-11-migr'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-11-migr'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/11-migr'/> <cpu mode='custom' match='exact' check='partial'> <model fallback='forbid'>EPYC-Rome</model> <vendor>AMD</vendor> diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml index de92146eaacb..581cf2828605 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml @@ -257,6 +257,7 @@ <numad nodeset='0' cpuset='0-7'/> <libDir path='/var/lib/libvirt/qemu/domain-4-upstream'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-upstream'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/4-upstream'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml index 6bdd12825969..dacaa3e42f42 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml @@ -286,6 +286,7 @@ <numad nodeset='0' cpuset='0-7'/> <libDir path='/var/lib/libvirt/qemu/domain-3-upstream'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-3-upstream'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/3-upstream'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/tests/qemustatusxml2xmldata/migration-out-params-in.xml index 24ee86e4c04e..b914236b62fc 100644 --- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml @@ -268,6 +268,7 @@ </devices> <libDir path='/var/lib/libvirt/qemu/domain-7-nest'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-7-nest'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/7-nest'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml index f0f5df84ab20..3b3e83175997 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -258,6 +258,7 @@ <numad nodeset='6' cpuset='0-7'/> <libDir path='/var/lib/libvirt/qemu/domain-1-upstream'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-1-upstream'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/1-upstream'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='123'/> diff --git a/tests/qemustatusxml2xmldata/upgrade-out.xml b/tests/qemustatusxml2xmldata/upgrade-out.xml index e663b3dbb5e9..c7bc7128df60 100644 --- a/tests/qemustatusxml2xmldata/upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/upgrade-out.xml @@ -256,6 +256,7 @@ <numad nodeset='6' cpuset='0-7'/> <libDir path='/var/lib/libvirt/qemu/domain-1-upstream'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-1-upstream'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/1-upstream'/> <chardevStdioLogd/> <allowReboot value='yes'/> <nodename index='0'/> diff --git a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml index fa6a6a99f480..6ee688ce037d 100644 --- a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml +++ b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml @@ -307,6 +307,7 @@ <numad nodeset='0-2' cpuset='1,3'/> <libDir path='/tmp'/> <channelTargetDir path='/var/lib/libvirt/qemu/channel/target'/> + <memoryBackingDir path='/var/lib/libvirt/qemu/ram/1729-QEMUGuest1'/> <allowReboot value='yes'/> <nodename index='0'/> <fdset index='0'/> -- 2.46.1