This function sets the memoryBackingDir in qemuDomainObjPrivate struct
so that it is remembered for the whole lifetime of a domain.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_domain.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d5c0c4b56834..577c53050651 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1735,6 +1735,27 @@ qemuDomainSecretPrepare(virQEMUDriver *driver,
}
+static void
+qemuDomainSetPrivateMemPath(qemuDomainObjPrivate *priv,
+ virQEMUDriverConfig *cfg,
+ const char *embedded_root,
+ const char *short_name)
+{
+ if (priv->memoryBackingDir)
+ return;
+
+ if (embedded_root && !STRPREFIX(cfg->memoryBackingDir, embedded_root)) {
+ g_autofree char *hash = virDomainDriverGenerateRootHash("qemu",
+ embedded_root);
+ priv->memoryBackingDir = g_strdup_printf("%s/%s-%s",
+ cfg->memoryBackingDir,
+ hash, short_name);
+ } else {
+ priv->memoryBackingDir = g_strdup_printf("%s/%s",
cfg->memoryBackingDir, short_name);
+ }
+}
+
+
/* This is the old way of setting up per-domain directories */
static void
qemuDomainSetPrivatePathsOld(virQEMUDriver *driver,
--
2.46.0