tests/qtest/migration: Fix auto-converge test
We fixed the cpu throttling sync thread affecting the dirty-sync-count, but the test still relies on it to gauge for progress. Remove that block from the test with no replacement. While here remove several incorrect or redundant comments. Fixes: 9519d3667a ("migration: Move iteration counter out of RAM") Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20260512141338.10089-1-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
Fabiano Rosas committed
May 12, 2026 at 11:13 UTC
b84815192cd3dc8303f030471d4e79c5de4fae94
1 file changed
+3
-59
tests/qtest/migration/precopy-tests.c
+3
-59
@@ -291,35 +291,12 @@ static void test_precopy_fd_socket(char *name, MigrateCommon *args)
291
}
292
#endif /* _WIN32 */
293
294
-/*
295
- * The way auto_converge works, we need to do too many passes to
296
- * run this test. Auto_converge logic is only run once every
297
- * three iterations, so:
298
- *
299
- * - 3 iterations without auto_converge enabled
300
- * - 3 iterations with pct = 5
301
- * - 3 iterations with pct = 30
302
- * - 3 iterations with pct = 55
303
- * - 3 iterations with pct = 80
304
- * - 3 iterations with pct = 95 (max(95, 80 + 25))
305
- *
306
- * To make things even worse, we need to run the initial stage at
307
- * 3MB/s so we enter autoconverge even when host is (over)loaded.
308
- */
294
static void test_auto_converge(char *name, MigrateCommon *args)
295
{
296
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
297
QTestState *from, *to;
298
int64_t percentage;
314
-
315
- /*
316
- * We want the test to be stable and as fast as possible.
317
- * E.g., with 1Gb/s bandwidth migration may pass without throttling,
318
- * so we need to decrease a bandwidth.
319
- */
299
const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
321
- uint64_t prev_dirty_sync_cnt, dirty_sync_cnt;
322
- int max_try_count, hit = 0;
300
301
if (migrate_start(&from, &to, uri, &args->start)) {
302
return;
@@ -330,21 +307,16 @@ static void test_auto_converge(char *name, MigrateCommon *args)
307
migrate_set_parameter_int(from, "cpu-throttle-increment", inc_pct);
308
migrate_set_parameter_int(from, "max-cpu-throttle", max_pct);
309
333
- /*
334
- * Set the initial parameters so that the migration could not converge
335
- * without throttling.
336
- */
310
migrate_ensure_non_converge(from);
311
312
/* To check remaining size after precopy */
313
migrate_set_capability(from, "pause-before-switchover", true);
314
342
- /* Wait for the first serial output from the source */
315
wait_for_serial("src_serial");
316
317
migrate_qmp(from, to, uri, NULL, "{}");
318
347
- /* Wait for throttling begins */
319
+ /* Wait until throttling begins */
320
percentage = 0;
321
do {
322
percentage = read_migrate_property_int(from, "cpu-throttle-percentage");
@@ -357,36 +329,8 @@ static void test_auto_converge(char *name, MigrateCommon *args)
329
/* The first percentage of throttling should be at least init_pct */
330
g_assert_cmpint(percentage, >=, init_pct);
331
360
- /*
361
- * End the loop when the dirty sync count greater than 1.
362
- */
363
- while ((dirty_sync_cnt = get_migration_pass(from)) < 2) {
364
- usleep(1000 * 1000);
365
- }
366
-
367
- prev_dirty_sync_cnt = dirty_sync_cnt;
368
-
369
- /*
370
- * The RAMBlock dirty sync count must changes in 5 seconds, here we set
371
- * the timeout to 10 seconds to ensure it changes.
372
- *
373
- * Note that migrate_ensure_non_converge set the max-bandwidth to 3MB/s,
374
- * while the qtest mem is >= 100MB, one iteration takes at least 33s (100/3)
375
- * to complete; this ensures that the RAMBlock dirty sync occurs.
376
- */
377
- max_try_count = 10;
378
- while (--max_try_count) {
379
- dirty_sync_cnt = get_migration_pass(from);
380
- if (dirty_sync_cnt != prev_dirty_sync_cnt) {
381
- hit = 1;
382
- break;
383
- }
384
- prev_dirty_sync_cnt = dirty_sync_cnt;
385
- sleep(1);
386
- }
387
- g_assert_cmpint(hit, ==, 1);
388
-
389
- /* Now, when we tested that throttling works, let it converge */
332
+ /* throttling always ignores the first pass */
333
+ assert(get_migration_pass(from) == 2);
334
migrate_ensure_converge(from);
335
336
/*