[PATCH 5/8] qemu_domain: Add qemuDomainSetPrivateMemPath()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux