]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_saveimage: add "sparse" to supported save image formats
authorJim Fehlig <jfehlig@suse.com>
Mon, 13 Jan 2025 22:57:50 +0000 (15:57 -0700)
committerJim Fehlig <jfehlig@suse.com>
Thu, 20 Mar 2025 17:17:48 +0000 (11:17 -0600)
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@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu.conf.in
src/qemu/qemu_saveimage.c
src/qemu/qemu_saveimage.h

index ed8016934884326fc85be261d72ae4d6fee03819..502adbf5c394ff350119a835dba4deb1e027f24f 100644 (file)
 # 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
index d940bfb5c3d6b6e11025f671d2bbd02a912de0bf..29b4e39879268731a2b22089ef981ae3374f88c9 100644 (file)
@@ -45,6 +45,7 @@ VIR_ENUM_IMPL(qemuSaveFormat,
               "xz",
               "lzop",
               "zstd",
+              "sparse",
 );
 
 static inline void
index 58f8252c8a01d96de1f16a5e5aca21ab46833edd..0411f3140aba72692863e9c068b2a6be20f1e878 100644 (file)
@@ -42,6 +42,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. */