From: Peter Xu <peterx@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Leonardo Bras" <leobras@redhat.com>
Subject: Re: [PATCH 16/42] migration-test: Create do_migrate()
Date: Tue, 20 Jun 2023 11:53:14 -0400 [thread overview]
Message-ID: <ZJHLahb43lc27gIR@x1n> (raw)
In-Reply-To: <20230608224943.3877-17-quintela@redhat.com>
On Fri, Jun 09, 2023 at 12:49:17AM +0200, Juan Quintela wrote:
> We called migrate_qmp() in lot of places. And there are tricks like
> changing tcp address with the right port.
>
> Only two callers remaining:
> - postcopy resume: It needs to play with the qmp.
> - baddest: We want to do a unvalid URI. For that we need to do it by
> hand.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> tests/qtest/migration-test.c | 41 ++++++++++++++++++------------------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index e623c43957..96b495f255 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -528,6 +528,17 @@ static void migrate_postcopy_start(QTestState *from, QTestState *to)
> qtest_qmp_eventwait(to, "RESUME");
> }
>
> +static void do_migrate(QTestState *from, QTestState *to, const gchar *uri)
> +{
> + if (!uri) {
> + g_autofree char *tcp_uri =
> + migrate_get_socket_address(to, "socket-address");
> + migrate_qmp(from, tcp_uri, "{}");
> + } else {
> + migrate_qmp(from, uri, "{}");
> + }
> +}
> +
> typedef struct {
> /*
> * QTEST_LOG=1 may override this. When QTEST_LOG=1, we always dump errors
> @@ -1173,7 +1184,7 @@ static void migrate_postcopy_prepare(QTestState **from_ptr,
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
>
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to, uri);
>
> wait_for_migration_pass(from);
>
> @@ -1378,6 +1389,9 @@ static void test_baddest(void)
> QTestState *from, *to;
>
> test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args);
> + /*
> + * Don't change to do_migrate(). We are using a wrong uri on purpose.
> + */
> migrate_qmp(from, "tcp:127.0.0.1:0", "{}");
> wait_for_migration_fail(from, false);
> test_migrate_end(from, to, false);
> @@ -1424,14 +1438,7 @@ static void test_precopy_common(MigrateCommon *args)
> }
> }
>
> - if (!args->connect_uri) {
> - g_autofree char *local_connect_uri =
> - migrate_get_socket_address(to, "socket-address");
> - migrate_qmp(from, local_connect_uri, "{}");
> - } else {
> - migrate_qmp(from, args->connect_uri, "{}");
> - }
> -
> + do_migrate(from, to, args->connect_uri);
>
> if (args->result != MIG_TEST_SUCCEED) {
> bool allow_active = args->result == MIG_TEST_FAIL;
> @@ -1586,7 +1593,7 @@ static void test_ignore_shared(void)
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
>
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to, uri);
>
> wait_for_migration_pass(from);
>
> @@ -1890,7 +1897,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
>
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to, uri);
>
> if (should_fail) {
> qtest_set_expected_status(to, EXIT_FAILURE);
> @@ -1991,7 +1998,7 @@ static void test_migrate_auto_converge(void)
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
>
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to, uri);
>
> /* Wait for throttling begins */
> percentage = 0;
> @@ -2280,7 +2287,6 @@ static void test_multifd_tcp_cancel(void)
> .hide_stderr = true,
> };
> QTestState *from, *to, *to2;
> - g_autofree char *uri = NULL;
>
> test_migrate_start(&from, &to, "defer", &args);
>
> @@ -2299,9 +2305,7 @@ static void test_multifd_tcp_cancel(void)
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
>
> - uri = migrate_get_socket_address(to, "socket-address");
> -
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to, "127.0.0.1:0");
I think this means migrating to "127.0.0.1:0". Can this work?
>
> wait_for_migration_pass(from);
>
> @@ -2325,14 +2329,11 @@ static void test_multifd_tcp_cancel(void)
> qtest_qmp_assert_success(to2, "{ 'execute': 'migrate-incoming',"
> " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}");
>
> - g_free(uri);
> - uri = migrate_get_socket_address(to2, "socket-address");
> -
> wait_for_migration_status(from, "cancelled", NULL);
>
> migrate_ensure_converge(from);
>
> - migrate_qmp(from, uri, "{}");
> + do_migrate(from, to2, "127.0.0.1:0");
>
> wait_for_migration_pass(from);
>
> --
> 2.40.1
>
--
Peter Xu
next prev parent reply other threads:[~2023-06-20 15:54 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 22:49 [PATCH 00/42] Migration test refactoring Juan Quintela
2023-06-08 22:49 ` [PATCH 01/42] migration-test: Be consistent for ppc Juan Quintela
2023-06-20 14:54 ` Peter Xu
2023-06-20 19:27 ` Laurent Vivier
2023-06-20 19:42 ` Peter Xu
2023-06-08 22:49 ` [PATCH 02/42] migration-test: Make ignore_stderr regular with other options Juan Quintela
2023-06-20 14:59 ` Peter Xu
2023-06-21 10:20 ` Juan Quintela
2023-06-08 22:49 ` [PATCH 03/42] migration-test: simplify shmem_opts handling Juan Quintela
2023-06-20 15:02 ` Peter Xu
2023-06-21 9:42 ` Juan Quintela
2023-06-21 13:15 ` Peter Xu
2023-06-08 22:49 ` [PATCH 04/42] migration-test: Make machine_opts regular with other options Juan Quintela
2023-06-20 15:03 ` Peter Xu
2023-06-08 22:49 ` [PATCH 05/42] migration-test: Create arch_opts Juan Quintela
2023-06-20 15:06 ` Peter Xu
2023-06-08 22:49 ` [PATCH 06/42] migration-test: machine_opts is really arch specific Juan Quintela
2023-06-20 15:07 ` Peter Xu
2023-06-08 22:49 ` [PATCH 07/42] migration-test: Create kvm_opts Juan Quintela
2023-06-20 15:07 ` Peter Xu
2023-06-08 22:49 ` [PATCH 08/42] migration-test: bootpath is the same for all tests and for all archs Juan Quintela
2023-06-20 15:11 ` Peter Xu
2023-06-08 22:49 ` [PATCH 09/42] migration-test: Add bootfile_create/delete() functions Juan Quintela
2023-06-20 15:17 ` Peter Xu
2023-06-08 22:49 ` [PATCH 10/42] migration-test: dirtylimit checks for x86_64 arch before Juan Quintela
2023-06-20 15:18 ` Peter Xu
2023-06-08 22:49 ` [PATCH 11/42] migration-test: Update test_ignore_shared to use args Juan Quintela
2023-06-20 15:21 ` Peter Xu
2023-06-21 9:58 ` Juan Quintela
2023-06-08 22:49 ` [PATCH 12/42] migration-test: Enable back ignore-shared test Juan Quintela
2023-06-20 15:27 ` Peter Xu
2023-06-21 19:38 ` Juan Quintela
2023-06-21 19:53 ` Peter Xu
2023-06-21 20:37 ` Juan Quintela
2023-06-21 21:53 ` Juan Quintela
2023-06-08 22:49 ` [PATCH 13/42] migration-test: Check for shared memory like for everything else Juan Quintela
2023-06-20 15:32 ` Peter Xu
2023-06-21 10:07 ` Juan Quintela
2023-06-21 13:14 ` Peter Xu
2023-06-21 18:56 ` Juan Quintela
2023-06-08 22:49 ` [PATCH 14/42] migration-test: test_migrate_start() always return 0 Juan Quintela
2023-06-20 15:35 ` Peter Xu
2023-06-08 22:49 ` [PATCH 15/42] migration-test: migrate_postcopy_prepare() " Juan Quintela
2023-06-20 15:36 ` Peter Xu
2023-06-08 22:49 ` [PATCH 16/42] migration-test: Create do_migrate() Juan Quintela
2023-06-20 15:53 ` Peter Xu [this message]
2023-06-21 10:30 ` Juan Quintela
2023-06-08 22:49 ` [PATCH 17/42] migration-test: Introduce GuestState Juan Quintela
2023-06-08 22:49 ` [PATCH 18/42] migration-test: Create guest before calling do_test_validate_uuid() Juan Quintela
2023-06-08 22:49 ` [PATCH 19/42] migration-test: Create guest before calling test_precopy_common() Juan Quintela
2023-06-08 22:49 ` [PATCH 20/42] migration-test: Create guest before calling test_postcopy_common() Juan Quintela
2023-06-08 22:49 ` [PATCH 21/42] migration-test: Move common guest code to guest_create() Juan Quintela
2023-06-08 22:49 ` [PATCH 22/42] migration-test: Create guest_use_dirty_log() Juan Quintela
2023-06-08 22:49 ` [PATCH 23/42] migration-test: Move serial to GuestState Juan Quintela
2023-06-08 22:49 ` [PATCH 24/42] migration-test: Re-enable multifd_cancel test Juan Quintela
2023-06-09 7:53 ` Daniel P. Berrangé
2023-06-09 10:22 ` Juan Quintela
2023-06-09 10:40 ` Daniel P. Berrangé
2023-06-08 22:49 ` [PATCH 25/42] migration-test: We were not waiting for "target" to finish Juan Quintela
2023-06-08 22:49 ` [PATCH 26/42] migration-test: create guest_use_shmem() Juan Quintela
2023-06-08 22:49 ` [PATCH 27/42] migration-test: Create guest_extra_opts() Juan Quintela
2023-06-08 22:49 ` [PATCH 28/42] migration-test: Create guest_hide_stderr() Juan Quintela
2023-06-08 22:49 ` [PATCH 29/42] migration-test: Create the migration unix socket by guest Juan Quintela
2023-06-08 22:49 ` [PATCH 30/42] migration-test: Hooks also need GuestState Juan Quintela
2023-06-08 22:49 ` [PATCH 31/42] migration-test: Preffer to->uri to uri parameter for migration Juan Quintela
2023-06-08 22:49 ` [PATCH 32/42] migration-test: Create guest_set_uri() Juan Quintela
2023-06-08 22:49 ` [PATCH 33/42] migration-test: Remove connect_uri Juan Quintela
2023-06-08 22:49 ` [PATCH 34/42] migration-test: Use new schema for all tests that use unix sockets Juan Quintela
2023-06-08 22:49 ` [PATCH 35/42] migration-test: Set uri for tcp tests with guest_set_uri() Juan Quintela
2023-06-08 22:49 ` [PATCH 36/42] migration-test: Remove unused listen_uri Juan Quintela
2023-06-08 22:49 ` [PATCH 37/42] migration-test: Create get_event GuestState variable Juan Quintela
2023-06-08 22:49 ` [PATCH 38/42] migration-test: Create guest_realize() Juan Quintela
2023-06-08 22:49 ` [PATCH 39/42] migration-test: Unfold test_migrate_end() into three functions Juan Quintela
2023-06-08 22:49 ` [PATCH 40/42] migration-test: Create migrate_incoming() function Juan Quintela
2023-06-08 22:49 ` [PATCH 41/42] migration-test: Move functions to migration-helpers.c Juan Quintela
2023-06-08 22:49 ` [PATCH 42/42] migration-test: Split vcpu-dirty-limit-test Juan Quintela
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=ZJHLahb43lc27gIR@x1n \
--to=peterx@redhat.com \
--cc=berrange@redhat.com \
--cc=leobras@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.com \
/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).