[libvirt RFCv7 34/40] qemu: saveimage: add multifd-compression field to save format
Claudio Fontana
cfontana at suse.de
Fri May 6 14:34:43 UTC 2022
On 5/6/22 4:32 PM, Claudio Fontana wrote:
> One thing I was thinking about, beyond what is in this patch,
>
> is that for the QEMU driver we could save the number of channels used for the --parallel save in the qemu SaveImage header as well.
>
> This way, on restore libvirt would automatically know how many file it needs to load, and the
> user does not need to know beforehand which --parallel-connections NN to use.
>
> Still the --parallel on resume would be needed in the current design, but that could theoretically be dropped as well.
> However, I wonder if that would create issues for other hypervisors implementing this, ie I presume keeping the --parallel flag would be the safest option.
, ... ie I presume keeping the --parallel flag as a mandatory parameter to the virsh restore command when restoring from a parallel saved image would be the safest option.
>
> Thanks,
>
> Claudio
>
>
> On 5/6/22 3:11 PM, Claudio Fontana wrote:
>> Signed-off-by: Claudio Fontana <cfontana at suse.de>
>> ---
>> src/qemu/qemu_saveimage.c | 19 ++++++++++++++++++-
>> src/qemu/qemu_saveimage.h | 5 +++--
>> 2 files changed, 21 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
>> index 35a75069e8..c0920c5baa 100644
>> --- a/src/qemu/qemu_saveimage.c
>> +++ b/src/qemu/qemu_saveimage.c
>> @@ -67,6 +67,23 @@ VIR_ENUM_IMPL(qemuSaveCompression,
>> "lzop",
>> );
>>
>> +typedef enum {
>> + QEMU_SAVE_MULTIFD_COMP_NONE = 0,
>> + QEMU_SAVE_MULTIFD_COMP_ZLIB = 1,
>> + QEMU_SAVE_MULTIFD_COMP_ZSTD = 2,
>> +
>> + /* used for the on-disk format, do not change/re-use numbers */
>> + QEMU_SAVE_MULTIFD_COMP_LAST
>> +} virQEMUSaveMultiFdComp;
>> +
>> +VIR_ENUM_DECL(qemuSaveMultiFdComp);
>> +VIR_ENUM_IMPL(qemuSaveMultiFdComp,
>> + QEMU_SAVE_MULTIFD_COMP_LAST,
>> + "none",
>> + "zlib",
>> + "zstd",
>> +);
>> +
>> static inline void
>> qemuSaveImageBswapHeader(virQEMUSaveHeader *hdr)
>> {
>> @@ -882,7 +899,7 @@ qemuSaveImageStartVM(virConnectPtr conn,
>> virDomainXMLOptionGetSaveCookie(driver->xmlopt)) < 0)
>> goto cleanup;
>>
>> - if ((header->version == 2) &&
>> + if ((header->version >= 2) &&
>> (header->compressed != QEMU_SAVE_FORMAT_RAW)) {
>> if (!(cmd = qemuSaveImageGetCompressionCommand(header->compressed)))
>> goto cleanup;
>> diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h
>> index ae7b3faa17..eb0734101e 100644
>> --- a/src/qemu/qemu_saveimage.h
>> +++ b/src/qemu/qemu_saveimage.h
>> @@ -30,7 +30,7 @@
>> */
>> #define QEMU_SAVE_MAGIC "LibvirtQemudSave"
>> #define QEMU_SAVE_PARTIAL "LibvirtQemudPart"
>> -#define QEMU_SAVE_VERSION 2
>> +#define QEMU_SAVE_VERSION 3
>>
>> G_STATIC_ASSERT(sizeof(QEMU_SAVE_MAGIC) == sizeof(QEMU_SAVE_PARTIAL));
>>
>> @@ -42,7 +42,8 @@ struct _virQEMUSaveHeader {
>> uint32_t was_running;
>> uint32_t compressed;
>> uint32_t cookieOffset;
>> - uint32_t unused[14];
>> + uint32_t multifd_comp;
>> + uint32_t unused[13];
>> };
>>
>>
>>
>
More information about the libvir-list
mailing list