From fdb7b1e19a47eaabf00463f44f659e28b9a18350 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Fri, 14 Feb 2025 16:26:12 -0700 Subject: [PATCH] include: Define constant for save image format MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add a new VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT typed parameter for specifying the save image format. A format specified via the virDomainSaveParams API overrides the save_image_format setting in qemu.conf. The 'raw' format remains the default. Signed-off-by: Jim Fehlig Reviewed-by: Daniel P. Berrangé --- include/libvirt/libvirt-domain.h | 13 +++++++++++++ src/libvirt-domain.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 2d27f96be9..0121620e9c 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1700,6 +1700,19 @@ int virDomainRestoreParams (virConnectPtr conn, */ # define VIR_DOMAIN_SAVE_PARAM_DXML "dxml" +/** + * VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT: + * + * an optional parameter used to specify the format of the save image. + * Valid formats are raw, zstd, lzop, gzip, bzip2, and xz. If not + * specified, the save_image_format setting in qemu.conf is used, which + * defaults to raw. As VIR_TYPED_PARAM_STRING. + * + * Since: 11.2.0 + */ +# define VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT "image_format" + + /* See below for virDomainSaveImageXMLFlags */ char * virDomainSaveImageGetXMLDesc (virConnectPtr conn, const char *file, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 05101756a1..18451ebdb9 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -1010,6 +1010,9 @@ virDomainSaveFlags(virDomainPtr domain, const char *to, * If VIR_DOMAIN_SAVE_PARAM_FILE is not provided then a managed save is * performed (see virDomainManagedSave). * + * See VIR_DOMAIN_SAVE_PARAM_* for detailed description of accepted save + * parameters. + * * Returns 0 in case of success and -1 in case of failure. * * Since: 8.4.0 -- 2.47.3