[PATCH 1/3] Add public API for parallel compression method

Jiang Jiacheng jiangjiacheng at huawei.com
Tue Jan 17 13:58:39 UTC 2023



On 2023/1/17 16:44, Claudio Fontana wrote:
> Hi,
> 
> On 1/16/23 14:42, Jiang Jiacheng wrote:
>> Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION,
>> VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL
>> for migration APIs to support set compression method
>> and compress level used during migration.
>>
>> Signed-off-by: Jiang Jiacheng <jiangjiacheng at huawei.com>
> 
> we don't know what drivers other than QEMU are going to implement in terms of algorithms,
> and we also don't know what new algorithms QEMU will come up with in the future,
> 

Indeed, what you're talking about is better and more scalable. These
patches only adapt to the three parameters of the current version
QEMU,and some commits on the QEMU side may be required to support this
mode.

> so I was told when I was working on something similar (but not identical),
> for the "multifd save restore prototype" to try to make it more general.
> 
> First of all, maybe we don't need two different _LEVEL parameters,
> just a VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION_LEVEL, which is then mapped in the qemu driver to the specific correct QEMU parameter according to the chosen algo.
> 

Since QEMU sets different parameters for different compression methods,
I've added two corresponding parameters here. If the qemu side does not
change, we can use the same virsh option to input the compression level
and pass the expected QEMU parameters according to the input compression
method on the libvirt side.

> Then the VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION could be a freeform string, that is then interpreted by each driver, for example "zlib", or "zstd" in this case.
> So other drivers can pass different strings, and QEMU future new compression algorithms will not need changes to libvirt at all.

I think what you mean is we can input any string to
VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION and whether it is available is
judged by QEMU or other emulators.
It is supported with these patches, we can use any string for this
parameter, though QEMU only support 'none', 'zlib','zstd' for it, and
other input will return with an error.

Thanks for your reply and suggestion!
Jiang Jiacheng

> 
> Thanks,
> 
> Claudio
> 
>> ---
>>  include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++++++++
>>  1 file changed, 30 insertions(+)
>>
>> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
>> index 5152ed4551..981f4e5160 100644
>> --- a/include/libvirt/libvirt-domain.h
>> +++ b/include/libvirt/libvirt-domain.h
>> @@ -1351,6 +1351,36 @@ typedef enum {
>>   */
>>  # define VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS     "parallel.connections"
>>  
>> +/**
>> + * VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION:
>> + *
>> + * virDomainMigrate* params field: compression method used during parallel
>> + * migration. As VIR_TYPED_PARAM_INT.
>> + *
>> + * Since: 9.1.0
>> + */
>> +# define VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION     "parallel.compression"
>> +
>> +/**
>> + * VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL:
>> + *
>> + * virDomainMigrate* params field: zlib compress level used during parallel
>> + * migration. As VIR_TYPED_PARAM_INT.
>> + *
>> + * Since: 9.1.0
>> + */
>> +# define VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL      "parallel.zlib.level"
>> +
>> +/**
>> + * VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL:
>> + *
>> + * virDomainMigrate* params field: zstd compress level used during parallel
>> + * migration. As VIR_TYPED_PARAM_INT.
>> + *
>> + * Since: 9.1.0
>> + */
>> +# define VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL      "parallel.zstd.level"
>> +
>>  /**
>>   * VIR_MIGRATE_PARAM_TLS_DESTINATION:
>>   *
> 



More information about the libvir-list mailing list