Eric Blake <ebl...@redhat.com> wrote: > On 1/23/20 5:58 AM, Juan Quintela wrote: >> Signed-off-by: Juan Quintela <quint...@redhat.com> >> --- >> hw/core/qdev-properties.c | 2 +- >> migration/Makefile.objs | 1 + >> migration/migration.c | 6 + >> migration/multifd-zstd.c | 304 +++++++++++++++++++++++++++++++++++ >> migration/multifd.h | 20 +++ >> migration/ram.c | 1 - >> qapi/migration.json | 2 +- >> tests/qtest/migration-test.c | 10 ++ >> 8 files changed, 343 insertions(+), 3 deletions(-) >> create mode 100644 migration/multifd-zstd.c >> > >> +++ b/migration/Makefile.objs >> @@ -9,6 +9,7 @@ common-obj-y += qjson.o >> common-obj-y += block-dirty-bitmap.o >> common-obj-y += multifd.o >> common-obj-y += multifd-zlib.o >> +common-obj-$(CONFIG_ZSTD) += multifd-zstd.o
Hi > zstd support is conditional... yeap. >> +++ b/qapi/migration.json >> @@ -499,7 +499,7 @@ >> # >> ## >> { 'enum': 'MultifdCompress', >> - 'data': [ 'none', 'zlib' ] } >> + 'data': [ 'none', 'zlib', 'zstd' ] } > > ...so I would expect an 'if' conditional here when declaring the > enum. It also needs documentation. I fully agree about the documentation part. But if you are setting zstd, and zstd is compiled out, we are giving the error showed in the code shown below. I am open to do anyother way. I don't speak qapi natively O:-) Later, Juan. diff --git a/migration/migration.c b/migration/migration.c index d25fdb3e6b..f0d5ade1df 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1256,6 +1256,12 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp) "is invalid, it must be in the range of 1 to 10000 ms"); return false; } + if (params->has_multifd_compress && + params->multifd_compress == MULTIFD_COMPRESS_ZSTD && + !multifd_compress_zstd_is_enabled()) { + error_setg(errp, "The multifd compression method zstd is compiled out"); + return false; + } return true; }