On Mon, Jun 30, 2025 at 04:59:11PM -0300, Fabiano Rosas wrote: > Allow migrate_start_set_capabilities() to set the config object > instead of setting the capabilities via calls to > migrate-set-capabilities. > > Signed-off-by: Fabiano Rosas <faro...@suse.de> > --- > tests/qtest/migration/framework.c | 31 +++++++++++++++++++++++++++++++ > tests/qtest/migration/framework.h | 1 + > 2 files changed, 32 insertions(+) > > diff --git a/tests/qtest/migration/framework.c > b/tests/qtest/migration/framework.c > index 407c9023c0..9ff5576328 100644 > --- a/tests/qtest/migration/framework.c > +++ b/tests/qtest/migration/framework.c > @@ -211,6 +211,37 @@ static QList *migrate_start_get_qmp_capabilities(const > MigrateStart *args) > static void migrate_start_set_capabilities(QTestState *from, QTestState *to, > MigrateStart *args) > { > + if (args->config) { > + const char *cap_multifd; > + bool multifd; > + > + for (uint8_t i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { > + const char *cap = MigrationCapability_lookup.array[i]; > + > + if (!args->caps[i]) { > + continue; > + } > + > + qdict_put_bool(args->config, cap, true); > + } > + > + if (!args->defer_target_connect) { > + qdict_put_bool(args->config, "events", true); > + }
This will disable events on src too when defer_target_connect is set. Maybe it's ok to just not test "events" on src for those (almost cpr ones), but maybe worth mentioning if so. > + > + cap_multifd = MigrationCapability_str(MIGRATION_CAPABILITY_MULTIFD); > + multifd = qdict_get_try_bool(args->config, cap_multifd, false); I get you, but when args->cap[] is still around it's a bit weird to not just use args->cap[MIGRATION_CAPABILITY_MULTIFD]. I also saw the next patch that we'll also support both "if (config) ... else ...". If we decide to switchover at some point, shall we have one patch converting all existing usages (including removing args->cap[]) to use ->config? The only outliers should be the parameters we set only after QMP migrate / migrate_incoming. > + > + if (multifd) { > + qdict_put_int(args->config, "multifd-channels", > + MULTIFD_TEST_CHANNELS); > + qdict_put_int(args->config, "multifd-channels", > + MULTIFD_TEST_CHANNELS); > + } > + > + return; > + } > + > /* > * MigrationCapability_lookup and MIGRATION_CAPABILITY_ constants > * are from qapi-types-migration.h. > diff --git a/tests/qtest/migration/framework.h > b/tests/qtest/migration/framework.h > index 01e425e64e..9b281d6757 100644 > --- a/tests/qtest/migration/framework.h > +++ b/tests/qtest/migration/framework.h > @@ -128,6 +128,7 @@ typedef struct { > * migration_set_capabilities(). > */ > bool caps[MIGRATION_CAPABILITY__MAX]; > + QDict *config; > } MigrateStart; > > typedef enum PostcopyRecoveryFailStage { > -- > 2.35.3 > -- Peter Xu