Adapt the convergence routines migrate_ensure_[non_]converge to receive a config argument and set the convergence parameters in it instead of using migrate-set-parameters.
Signed-off-by: Fabiano Rosas <faro...@suse.de> --- tests/qtest/migration/framework.c | 10 +++++----- tests/qtest/migration/migration-qmp.c | 22 ++++++++++++++++------ tests/qtest/migration/migration-qmp.h | 4 ++-- tests/qtest/migration/misc-tests.c | 4 ++-- tests/qtest/migration/precopy-tests.c | 22 +++++++++++----------- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c index 9ff5576328..5025299d6a 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -513,7 +513,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, args->postcopy_data = args->start_hook(from, to); } - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," " 'arguments': { " @@ -791,7 +791,7 @@ void test_precopy_common(MigrateCommon *args) } if (args->live) { - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); } else { /* @@ -803,7 +803,7 @@ void test_precopy_common(MigrateCommon *args) if (args->result == MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); wait_for_stop(from, &src_state); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); } } @@ -862,7 +862,7 @@ void test_precopy_common(MigrateCommon *args) } migrate_wait_for_dirty_mem(from, to); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); /* * We do this first, as it has a timeout to stop us @@ -965,7 +965,7 @@ void test_file_common(MigrateCommon *args, bool stop_src) data_hook = args->start_hook(from, to); } - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); wait_for_serial("src_serial"); if (stop_src) { diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/migration-qmp.c index d82ac8c750..8918ce87d8 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -471,18 +471,28 @@ void migrate_set_parameter_bool(QTestState *who, const char *parameter, migrate_check_parameter_bool(who, parameter, value); } -void migrate_ensure_non_converge(QTestState *who) +void migrate_ensure_non_converge(QTestState *who, QDict *config) { /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ - migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000); - migrate_set_parameter_int(who, "downtime-limit", 1); + if (config) { + qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 1); + } else { + migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000); + migrate_set_parameter_int(who, "downtime-limit", 1); + } } -void migrate_ensure_converge(QTestState *who) +void migrate_ensure_converge(QTestState *who, QDict *config) { /* Should converge with 30s downtime + 1 gbs bandwidth limit */ - migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000); - migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); + if (config) { + qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 30 * 1000); + } else { + migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000); + migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); + } } void migrate_pause(QTestState *who) diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/migration-qmp.h index faa8181d91..a80546a258 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -36,8 +36,8 @@ void migrate_set_parameter_str(QTestState *who, const char *parameter, const char *value); void migrate_set_parameter_bool(QTestState *who, const char *parameter, int value); -void migrate_ensure_non_converge(QTestState *who); -void migrate_ensure_converge(QTestState *who); +void migrate_ensure_non_converge(QTestState *who, QDict *config); +void migrate_ensure_converge(QTestState *who, QDict *config); void migrate_pause(QTestState *who); void migrate_continue(QTestState *who, const char *state); void migrate_recover(QTestState *who, const char *uri); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c index 54995256d8..abbbf966e9 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -70,7 +70,7 @@ static void test_analyze_script(void) file = g_strdup_printf("%s/migfile", tmpfs); uri = g_strdup_printf("exec:cat > %s", file); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); migrate_qmp(from, to, uri, NULL, "{}"); wait_for_migration_complete(from); @@ -105,7 +105,7 @@ static void test_ignore_shared(void) return; } - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); migrate_prepare_for_dirty_mem(from); /* Wait for the first serial output from the source */ diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c index bb38292550..35d4274c69 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -387,7 +387,7 @@ static void test_auto_converge(void) * Set the initial parameters so that the migration could not converge * without throttling. */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); /* To check remaining size after precopy */ migrate_set_capability(from, "pause-before-switchover", true); @@ -440,7 +440,7 @@ static void test_auto_converge(void) g_assert_cmpint(hit, ==, 1); /* Now, when we tested that throttling works, let it converge */ - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); /* * Wait for pre-switchover status to check last throttle percentage @@ -580,7 +580,7 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) return; } - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); migrate_prepare_for_dirty_mem(from); if (postcopy_ram) { @@ -640,13 +640,13 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}"); - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); migrate_qmp(from, to2, NULL, NULL, "{}"); migrate_wait_for_dirty_mem(from, to2); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); wait_for_stop(from, get_src()); qtest_qmp_eventwait(to2, "RESUME"); @@ -675,7 +675,7 @@ static void test_cancel_src_after_failed(QTestState *from, QTestState *to, */ wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); @@ -699,7 +699,7 @@ static void test_cancel_src_after_cancelled(QTestState *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); @@ -723,7 +723,7 @@ static void test_cancel_src_after_complete(QTestState *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); @@ -752,7 +752,7 @@ static void test_cancel_src_after_none(QTestState *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); wait_for_migration_complete(from); @@ -771,7 +771,7 @@ static void test_cancel_src_pre_switchover(QTestState *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); @@ -1080,7 +1080,7 @@ static void migrate_dirty_limit_wait_showup(QTestState *from, migrate_set_parameter_int(from, "vcpu-dirty-limit", value); /* Make sure migrate can't converge */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, NULL); /* To check limit rate after precopy */ migrate_set_capability(from, "pause-before-switchover", true); -- 2.35.3