tests/migration: Add case for periodic ramblock dirty sync
Signed-off-by: Hyman Huang <yong.huang@smartx.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/cb61504f1a1e9d5f2ca4dac12e518deb076ce9f3.1729146786.git.yong.huang@smartx.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
52ac968ab2
commit
bfd66ccb8d
@ -2791,6 +2791,8 @@ static void test_migrate_auto_converge(void)
|
||||
* so we need to decrease a bandwidth.
|
||||
*/
|
||||
const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
|
||||
uint64_t prev_dirty_sync_cnt, dirty_sync_cnt;
|
||||
int max_try_count, hit = 0;
|
||||
|
||||
if (test_migrate_start(&from, &to, uri, &args)) {
|
||||
return;
|
||||
@ -2827,6 +2829,36 @@ static void test_migrate_auto_converge(void)
|
||||
} while (true);
|
||||
/* The first percentage of throttling should be at least init_pct */
|
||||
g_assert_cmpint(percentage, >=, init_pct);
|
||||
|
||||
/*
|
||||
* End the loop when the dirty sync count greater than 1.
|
||||
*/
|
||||
while ((dirty_sync_cnt = get_migration_pass(from)) < 2) {
|
||||
usleep(1000 * 1000);
|
||||
}
|
||||
|
||||
prev_dirty_sync_cnt = dirty_sync_cnt;
|
||||
|
||||
/*
|
||||
* The RAMBlock dirty sync count must changes in 5 seconds, here we set
|
||||
* the timeout to 10 seconds to ensure it changes.
|
||||
*
|
||||
* Note that migrate_ensure_non_converge set the max-bandwidth to 3MB/s,
|
||||
* while the qtest mem is >= 100MB, one iteration takes at least 33s (100/3)
|
||||
* to complete; this ensures that the RAMBlock dirty sync occurs.
|
||||
*/
|
||||
max_try_count = 10;
|
||||
while (--max_try_count) {
|
||||
dirty_sync_cnt = get_migration_pass(from);
|
||||
if (dirty_sync_cnt != prev_dirty_sync_cnt) {
|
||||
hit = 1;
|
||||
break;
|
||||
}
|
||||
prev_dirty_sync_cnt = dirty_sync_cnt;
|
||||
sleep(1);
|
||||
}
|
||||
g_assert_cmpint(hit, ==, 1);
|
||||
|
||||
/* Now, when we tested that throttling works, let it converge */
|
||||
migrate_ensure_converge(from);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user