[PATCH V2 07/20] qemu_saveimage: add "sparse" to supported save image formats

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

 



Extend the list of formats to include "sparse", which uses QEMU's mapped-ram
stream format [1] to write guest memory blocks at fixed offsets in the save
image file.

[1] https://gitlab.com/qemu-project/qemu/-/blob/master/docs/devel/migration/mapped-ram.rst?ref_type=heads

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/qemu/qemu.conf.in     | 9 ++++++++-
 src/qemu/qemu_saveimage.c | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in
index d853136f10..ab9725e40d 100644
--- a/src/qemu/qemu.conf.in
+++ b/src/qemu/qemu.conf.in
@@ -588,11 +588,18 @@
 # disk space when saving large memory guests. Various compression formats are
 # available for specifying a save image compressed by the named algorithm.
 # Supported compression formats are "zstd", "lzop", "gzip", "bzip2", and "xz".
+# The "sparse" format uses QEMU's mapped-ram stream format to write guest memory
+# blocks at fixed offsets in the save image file.
 
 # save_image_format can be used to select the desired save format. "raw" is
 # the traditional format used by libvirt and is also the default. The
 # compression formats can be used to save disk space, although this typically
-# results in longer save and restore times.
+# results in longer save and restore times. The "sparse" format results in a
+# save image file that is roughly the logical size of the guest's memory,
+# although on-disk size is a function of guest memory usage. The "sparse"
+# format is useful when a predictable maximum save image file size is
+# needed. The other formats can result in a save image file much larger
+# than guest memory if the guest runs a memory intensive workload.
 #
 # save_image_format is used with 'virsh save' or 'virsh managedsave'. It is
 # an error if the specified save_image_format is not valid, or cannot be
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index 69617e07eb..ff5b9e72eb 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -48,6 +48,7 @@ typedef enum {
     QEMU_SAVE_FORMAT_XZ = 3,
     QEMU_SAVE_FORMAT_LZOP = 4,
     QEMU_SAVE_FORMAT_ZSTD = 5,
+    QEMU_SAVE_FORMAT_SPARSE = 6,
     /* Note: add new members only at the end.
        These values are used in the on-disk format.
        Do not change or re-use numbers. */
@@ -64,6 +65,7 @@ VIR_ENUM_IMPL(qemuSaveFormat,
               "xz",
               "lzop",
               "zstd",
+              "sparse",
 );
 
 static inline void
-- 
2.43.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