[PATCHv5 2/4] qemu_conf: Add param memory_backing_dir

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

 



Add new parameter memory_backing_dir where files will be stored when memoryBacking
source is selected as file.

Value is stored inside char* memoryBackingDir
---
 src/qemu/libvirtd_qemu.aug         | 3 +++
 src/qemu/qemu.conf                 | 4 ++++
 src/qemu/qemu_conf.c               | 9 +++++++++
 src/qemu/qemu_conf.h               | 2 ++
 src/qemu/test_libvirtd_qemu.aug.in | 1 +
 5 files changed, 19 insertions(+)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index de723b2..82bae9e 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -109,6 +109,8 @@ module Libvirtd_qemu =
 
    let gluster_debug_level_entry = int_entry "gluster_debug_level"
 
+   let memory_entry = str_entry "memory_backing_dir"
+
    (* Each entry in the config is one of the following ... *)
    let entry = default_tls_entry
              | vnc_entry
@@ -125,6 +127,7 @@ module Libvirtd_qemu =
              | log_entry
              | nvram_entry
              | gluster_debug_level_entry
+             | memory_entry
 
    let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
    let empty = [ label "#empty" . eol ]
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index a8cd369..97d769d 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -673,3 +673,7 @@
 # devices entries throughout the domain lifetime. This namespace is turned on
 # by default.
 #namespaces = [ "mount" ]
+
+# This directory is used for memoryBacking source if configured as file.
+# NOTE: big files will be stored here
+#memory_backing_dir = "/var/lib/libvirt/qemu/ram"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 6613d59..0223a95 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -186,6 +186,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
             goto error;
         if (virAsprintf(&cfg->nvramDir, "%s/nvram", cfg->libDir) < 0)
             goto error;
+        if (virAsprintf(&cfg->memoryBackingDir, "%s/ram", cfg->libDir) < 0)
+            goto error;
     } else {
         char *rundir;
         char *cachedir;
@@ -231,6 +233,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
         if (virAsprintf(&cfg->nvramDir,
                         "%s/qemu/nvram", cfg->configBaseDir) < 0)
             goto error;
+        if (virAsprintf(&cfg->memoryBackingDir, "%s/qemu/ram", cfg->configBaseDir) < 0)
+            goto error;
     }
 
     if (virAsprintf(&cfg->configDir, "%s/qemu", cfg->configBaseDir) < 0)
@@ -408,6 +412,8 @@ static void virQEMUDriverConfigDispose(void *obj)
     VIR_FREE(cfg->lockManagerName);
 
     virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
+
+    VIR_FREE(cfg->memoryBackingDir);
 }
 
 
@@ -835,6 +841,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         }
     }
 
+    if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBackingDir) < 0)
+        goto cleanup;
+
     ret = 0;
 
  cleanup:
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 92a7a50..91904ed 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -195,6 +195,8 @@ struct _virQEMUDriverConfig {
     virFirmwarePtr *firmwares;
     size_t nfirmwares;
     unsigned int glusterDebugLevel;
+
+    char *memoryBackingDir;
 };
 
 /* Main driver state */
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index a749f09..bd25235 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -94,3 +94,4 @@ module Test_libvirtd_qemu =
 { "namespaces"
     { "1" = "mount" }
 }
+{ "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" }
-- 
2.7.4

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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