[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 10/11] tests/qtest/migration: Support cleaning up only one si
From: |
Peter Xu |
Subject: |
[PATCH RFC 10/11] tests/qtest/migration: Support cleaning up only one side of migration |
Date: |
Tue, 3 Dec 2024 19:51:37 -0500 |
From: Fabiano Rosas <farosas@suse.de>
We don't always want to cleanup both VMs at the same time. One example
is the multifd cancel test, where there's a second migration reusing
the source VM. The next patches will add another instance, keeping the
destination VM instead.
Extract the cleanup routine from test_migrate_end() into another
function so it can be reused.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20241125144612.16194-4-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 1452778c81..74645f749c 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -883,13 +883,29 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
return 0;
}
+static void migrate_cleanup(QTestState *from, QTestState *to)
+{
+ if (from) {
+ qtest_quit(from);
+ unlink(src_state.serial);
+ g_free(src_state.serial);
+ }
+
+ if (to) {
+ qtest_quit(to);
+ unlink(dst_state.serial);
+ g_free(dst_state.serial);
+ }
+
+ cleanup("migsocket");
+ cleanup(FILE_TEST_FILENAME);
+}
+
static void test_migrate_end(QTestState *from, QTestState *to, bool test_dest)
{
unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d;
- qtest_quit(from);
-
- if (test_dest) {
+ if (to && test_dest) {
qtest_memread(to, start_address, &dest_byte_a, 1);
/* Destination still running, wait for a byte to change */
@@ -909,14 +925,7 @@ static void test_migrate_end(QTestState *from, QTestState
*to, bool test_dest)
check_guests_ram(to);
}
- qtest_quit(to);
-
- cleanup("migsocket");
- unlink(src_state.serial);
- g_free(src_state.serial);
- unlink(dst_state.serial);
- g_free(dst_state.serial);
- cleanup(FILE_TEST_FILENAME);
+ migrate_cleanup(from, to);
}
#ifdef CONFIG_GNUTLS
@@ -3309,9 +3318,7 @@ static void test_multifd_tcp_cancel(void)
/* Make sure QEMU process "to" exited */
qtest_set_expected_status(to, EXIT_FAILURE);
- qtest_wait_qemu(to);
- unlink(dst_state.serial);
- g_free(dst_state.serial);
+ migrate_cleanup(NULL, to);
/*
* Ensure the source QEMU finishes its cancellation process before we
--
2.47.0
- [PATCH RFC 00/11] migration/block: disk activation rewrite, Peter Xu, 2024/12/03
- [PATCH RFC 01/11] migration: Add helper to get target runstate, Peter Xu, 2024/12/03
- [PATCH RFC 03/11] migration/block: Apply late-block-active behavior to postcopy, Peter Xu, 2024/12/03
- [PATCH RFC 02/11] migration/block: Make late-block-active the default, Peter Xu, 2024/12/03
- [PATCH RFC 06/11] migration/block: Extend the migration_block_* API to dest side, Peter Xu, 2024/12/03
- [PATCH RFC 05/11] migration/block: Merge block reactivations for fail/cancel, Peter Xu, 2024/12/03
- [PATCH RFC 04/11] migration/block: Fix possible race with block_inactive, Peter Xu, 2024/12/03
- [PATCH RFC 08/11] tests/qtest/migration: Move more code under only_target, Peter Xu, 2024/12/03
- [PATCH RFC 10/11] tests/qtest/migration: Support cleaning up only one side of migration,
Peter Xu <=
- [PATCH RFC 09/11] tests/qtest/migration: Don't use hardcoded strings for -serial, Peter Xu, 2024/12/03
- [PATCH RFC 07/11] migration/block: Apply the migration_block_* API to postcopy, Peter Xu, 2024/12/03
- [PATCH RFC 11/11] tests/qtest/migration: Test successive migrations, Peter Xu, 2024/12/03
- Re: [PATCH RFC 00/11] migration/block: disk activation rewrite, Peter Xu, 2024/12/04