From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
"Dr . David Alan Gilbert" <dave@treblig.org>,
"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Andrey Drobyshev" <andrey.drobyshev@virtuozzo.com>,
peterx@redhat.com, "Stefan Hajnoczi" <stefanha@redhat.com>
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 [thread overview]
Message-ID: <20241204005138.702289-11-peterx@redhat.com> (raw)
In-Reply-To: <20241204005138.702289-1-peterx@redhat.com>
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
next prev parent reply other threads:[~2024-12-04 0:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 0:51 [PATCH RFC 00/11] migration/block: disk activation rewrite Peter Xu
2024-12-04 0:51 ` [PATCH RFC 01/11] migration: Add helper to get target runstate Peter Xu
2024-12-04 0:51 ` [PATCH RFC 02/11] migration/block: Make late-block-active the default Peter Xu
2024-12-04 0:51 ` [PATCH RFC 03/11] migration/block: Apply late-block-active behavior to postcopy Peter Xu
2024-12-04 0:51 ` [PATCH RFC 04/11] migration/block: Fix possible race with block_inactive Peter Xu
2024-12-04 0:51 ` [PATCH RFC 05/11] migration/block: Merge block reactivations for fail/cancel Peter Xu
2024-12-04 0:51 ` [PATCH RFC 06/11] migration/block: Extend the migration_block_* API to dest side Peter Xu
2024-12-04 14:49 ` Peter Xu
2024-12-04 0:51 ` [PATCH RFC 07/11] migration/block: Apply the migration_block_* API to postcopy Peter Xu
2024-12-04 0:51 ` [PATCH RFC 08/11] tests/qtest/migration: Move more code under only_target Peter Xu
2024-12-04 0:51 ` [PATCH RFC 09/11] tests/qtest/migration: Don't use hardcoded strings for -serial Peter Xu
2024-12-04 19:11 ` Fabiano Rosas
2024-12-04 0:51 ` Peter Xu [this message]
2024-12-04 0:51 ` [PATCH RFC 11/11] tests/qtest/migration: Test successive migrations Peter Xu
2024-12-04 17:25 ` [PATCH RFC 00/11] migration/block: disk activation rewrite Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241204005138.702289-11-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=berrange@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).