@samitouri / QOSamiQemu / commits / bad6e11d61

tests/qtest/migration: Stop passing URI into migrate_start

Don't allow changing the default -incoming URI via migrate_start. The default is now -incoming defer. If a test really needs to alter this (such as with CPR), the target_opts variable is still available to change the command line. (aside from the larger goal of using defer, this change is a step towards allowing migrate_start() to be invoked only once for all tests) Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Lukas Straub <lukasstraub2@web.de> Tested-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20260505160915.25558-15-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>

Fabiano Rosas committed May 5, 2026 at 13:09 UTC bad6e11d61dec6324d72d5430f949fae339be463
7 files changed +26 -29
tests/qtest/migration/colo-tests.c
+1 -1
@@ -45,7 +45,7 @@ static int test_colo_common(MigrateCommon *args,
45 args->start.caps[MIGRATION_CAPABILITY_RETURN_PATH] = true;
46 args->start.caps[MIGRATION_CAPABILITY_X_COLO] = true;
47
48 - if (migrate_start(&from, &to, "defer", &args->start)) {
48 + if (migrate_start(&from, &to, &args->start)) {
49 return -1;
50 }
51
tests/qtest/migration/cpr-tests.c
+3 -3
@@ -60,7 +60,7 @@ static int test_transfer(MigrateCommon *args, const char *cpr_channel,
60 obj = migrate_str_to_channel(cpr_channel);
61 qlist_append(channels_list, obj);
62
63 - if (migrate_start(&from, &to, "defer", &args->start)) {
63 + if (migrate_start(&from, &to, &args->start)) {
64 return -1;
65 }
66
@@ -179,7 +179,7 @@ static void set_cpr_exec_args(QTestState *who, MigrateCommon *args)
179 */
180 g_assert(args->start.hide_stderr == false);
181
182 - ret = migrate_args(&from_args, &to_args, args->listen_uri, &args->start);
182 + ret = migrate_args(&from_args, &to_args, &args->start);
183 g_assert(!ret);
184 qtest_from_args = qtest_qemu_args(from_args);
185
@@ -230,7 +230,7 @@ static void test_cpr_exec(MigrateCommon *args)
230 g_autofree char *filename = g_strdup_printf("%s/%s", tmpfs,
231 FILE_TEST_FILENAME);
232
233 - if (migrate_start(&from, NULL, "defer", &args->start)) {
233 + if (migrate_start(&from, NULL, &args->start)) {
234 return;
235 }
236
tests/qtest/migration/file-tests.c
+1 -2
@@ -47,8 +47,7 @@ static void test_file_connect_outgoing_fd_leak(char *name, MigrateCommon *args)
47 return;
48 }
49
50 - args->listen_uri = "defer";
51 - if (migrate_start(&from, &to, args->listen_uri, &args->start)) {
50 + if (migrate_start(&from, &to, &args->start)) {
51 return;
52 }
53
tests/qtest/migration/framework.c
+8 -9
@@ -308,7 +308,7 @@ static char *migrate_mem_type_get_opts(MemType type, const char *memory_size)
308 return opts;
309 }
310
311 -int migrate_args(char **from, char **to, const char *uri, MigrateStart *args)
311 +int migrate_args(char **from, char **to, MigrateStart *args)
312 {
313 /* options for source and target */
314 g_autofree gchar *arch_opts = NULL;
@@ -423,11 +423,11 @@ int migrate_args(char **from, char **to, const char *uri, MigrateStart *args)
423 "-name target,debug-threads=on "
424 "%s "
425 "-serial file:%s/dest_serial "
426 - "-incoming %s "
426 + "-incoming defer "
427 "%s %s %s %s",
428 kvm_opts ? kvm_opts : "",
429 machine, machine_opts,
430 - memory_backend, tmpfs, uri,
430 + memory_backend, tmpfs,
431 events,
432 arch_opts ? arch_opts : "",
433 args->opts_target ? args->opts_target : "",
@@ -474,8 +474,7 @@ static void migrate_mem_type_cleanup(MemType type)
474 }
475 }
476
477 -int migrate_start(QTestState **from, QTestState **to, const char *uri,
478 - MigrateStart *args)
477 +int migrate_start(QTestState **from, QTestState **to, MigrateStart *args)
478 {
479 g_autofree gchar *cmd_source = NULL;
480 g_autofree gchar *cmd_target = NULL;
@@ -490,7 +489,7 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
489 bootfile_create(qtest_get_arch(), tmpfs, args->suspend_me);
490 src_state.suspend_me = args->suspend_me;
491
493 - if (migrate_args(&cmd_source, &cmd_target, uri, args)) {
492 + if (migrate_args(&cmd_source, &cmd_target, args)) {
493 return -1;
494 }
495
@@ -563,7 +562,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
562 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] = true;
563 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] = true;
564
566 - if (migrate_start(&from, &to, "defer", &args->start)) {
565 + if (migrate_start(&from, &to, &args->start)) {
566 return -1;
567 }
568
@@ -842,7 +841,7 @@ int test_precopy_common(MigrateCommon *args)
841 args->listen_uri = "tcp:127.0.0.1:0";
842 }
843
845 - if (migrate_start(&from, &to, "defer", &args->start)) {
844 + if (migrate_start(&from, &to, &args->start)) {
845 return -1;
846 }
847
@@ -991,7 +990,7 @@ void test_file_common(MigrateCommon *args, bool stop_src)
990 bool check_offset = false;
991 g_autofree char *uri = NULL;
992
994 - if (migrate_start(&from, &to, "defer", &args->start)) {
993 + if (migrate_start(&from, &to, &args->start)) {
994 return;
995 }
996
tests/qtest/migration/framework.h
+2 -3
@@ -231,9 +231,8 @@ void wait_for_serial(const char *side);
231 void migrate_prepare_for_dirty_mem(QTestState *from);
232 void migrate_wait_for_dirty_mem(QTestState *from, QTestState *to);
233
234 -int migrate_args(char **from, char **to, const char *uri, MigrateStart *args);
235 -int migrate_start(QTestState **from, QTestState **to, const char *uri,
236 - MigrateStart *args);
234 +int migrate_args(char **from, char **to, MigrateStart *args);
235 +int migrate_start(QTestState **from, QTestState **to, MigrateStart *args);
236 void migrate_end(QTestState *from, QTestState *to, bool test_dest);
237
238 void test_postcopy_common(MigrateCommon *args);
tests/qtest/migration/misc-tests.c
+5 -5
@@ -28,7 +28,7 @@ static void test_baddest(char *name, MigrateCommon *args)
28
29 args->start.hide_stderr = true;
30
31 - if (migrate_start(&from, &to, "defer", &args->start)) {
31 + if (migrate_start(&from, &to, &args->start)) {
32 return;
33 }
34
@@ -54,7 +54,7 @@ static void test_analyze_script(char *name, MigrateCommon *args)
54 return;
55 }
56
57 - if (migrate_start(&from, &to, "defer", &args->start)) {
57 + if (migrate_start(&from, &to, &args->start)) {
58 return;
59 }
60
@@ -115,7 +115,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
115 g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
116 QTestState *from, *to;
117
118 - if (migrate_start(&from, &to, "defer", args)) {
118 + if (migrate_start(&from, &to, args)) {
119 return;
120 }
121
@@ -180,7 +180,7 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
180 QTestState *from, *to;
181 QObject *channels;
182
183 - if (migrate_start(&from, &to, "defer", &args->start)) {
183 + if (migrate_start(&from, &to, &args->start)) {
184 return;
185 }
186
@@ -234,7 +234,7 @@ static void test_validate_caps_pair(char *test_path, MigrateCommon *args)
234 args->start.hide_stderr = true;
235 args->start.only_source = true;
236
237 - if (migrate_start(&from, &to, "defer", &args->start)) {
237 + if (migrate_start(&from, &to, &args->start)) {
238 return;
239 }
240
tests/qtest/migration/precopy-tests.c
+6 -6
@@ -268,7 +268,7 @@ static void test_auto_converge(char *name, MigrateCommon *args)
268 int64_t percentage;
269 const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
270
271 - if (migrate_start(&from, &to, "defer", &args->start)) {
271 + if (migrate_start(&from, &to, &args->start)) {
272 return;
273 }
274
@@ -414,7 +414,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args, bool postcopy_ram)
414
415 args->start.hide_stderr = true;
416
417 - if (migrate_start(&from, &to, "defer", &args->start)) {
417 + if (migrate_start(&from, &to, &args->start)) {
418 return;
419 }
420
@@ -460,7 +460,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args, bool postcopy_ram)
460
461 args->start.only_target = true;
462
463 - if (migrate_start(&from, &to2, "defer", &args->start)) {
463 + if (migrate_start(&from, &to2, &args->start)) {
464 return;
465 }
466
@@ -634,7 +634,7 @@ static void test_cancel_src_after_status(char *test_path, MigrateCommon *args)
634
635 args->start.hide_stderr = true;
636
637 - if (migrate_start(&from, &to, "defer", &args->start)) {
637 + if (migrate_start(&from, &to, &args->start)) {
638 return;
639 }
640
@@ -973,7 +973,7 @@ static void test_dirty_limit(char *name, MigrateCommon *args)
973 args->connect_uri = uri;
974
975 /* Start src, dst vm */
976 - if (migrate_start(&from, &to, "defer", &args->start)) {
976 + if (migrate_start(&from, &to, &args->start)) {
977 return;
978 }
979
@@ -1021,7 +1021,7 @@ static void test_dirty_limit(char *name, MigrateCommon *args)
1021 args->start.use_dirty_ring = true;
1022
1023 /* Restart dst vm, src vm already show up so we needn't wait anymore */
1024 - if (migrate_start(&from, &to, "defer", &args->start)) {
1024 + if (migrate_start(&from, &to, &args->start)) {
1025 return;
1026 }
1027