All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Peter Xu <peterx@redhat.com>, Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 4/8] tests/qtest/migration: Stop invoking migrate_incoming from hooks
Date: Tue, 10 Mar 2026 16:47:53 +0100	[thread overview]
Message-ID: <20260310164753.1f71bebd@penguin> (raw)
In-Reply-To: <20260310135540.8679-4-farosas@suse.de>

[-- Attachment #1: Type: text/plain, Size: 10767 bytes --]

On Tue, 10 Mar 2026 10:55:36 -0300
Fabiano Rosas <farosas@suse.de> wrote:

> Now that the listen_uri is being properly used, tests can stop calling
> migrate_incoming from their hooks. The _common functions and
> migrate_start should take care of that.
> 
> Reviewed-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Lukas Straub <lukasstraub2@web.de>

> Link: https://lore.kernel.org/qemu-devel/20251215220041.12657-29-farosas@suse.de
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  tests/qtest/migration/colo-tests.c        |  4 ++++
>  tests/qtest/migration/compression-tests.c |  6 ++++++
>  tests/qtest/migration/framework.c         | 14 +++++++++++---
>  tests/qtest/migration/precopy-tests.c     |  7 ++++---
>  tests/qtest/migration/tls-tests.c         |  8 ++++++++
>  5 files changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/qtest/migration/colo-tests.c b/tests/qtest/migration/colo-tests.c
> index 7c438c196b..0d800429c5 100644
> --- a/tests/qtest/migration/colo-tests.c
> +++ b/tests/qtest/migration/colo-tests.c
> @@ -55,6 +55,10 @@ static int test_colo_common(MigrateCommon *args,
>          data_hook = args->start_hook(from, to);
>      }
>  
> +    if (args->start.incoming_defer) {
> +        migrate_incoming_qmp(to, args->listen_uri, NULL, "{}");
> +    }
> +
>      migrate_ensure_converge(from);
>      wait_for_serial("src_serial");
>  
> diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migration/compression-tests.c
> index eb0b7d6b4b..bed39dece0 100644
> --- a/tests/qtest/migration/compression-tests.c
> +++ b/tests/qtest/migration/compression-tests.c
> @@ -33,6 +33,7 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState *from,
>  
>  static void test_multifd_tcp_zstd(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_zstd;
>  
>      args->start.incoming_defer = true;
> @@ -43,6 +44,7 @@ static void test_multifd_tcp_zstd(char *name, MigrateCommon *args)
>  
>  static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_zstd,
>  
>      args->start.incoming_defer = true;
> @@ -66,6 +68,7 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestState *from,
>  
>  static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_qatzip;
>  
>      args->start.incoming_defer = true;
> @@ -85,6 +88,7 @@ migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *from,
>  
>  static void test_multifd_tcp_qpl(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_qpl;
>  
>      args->start.incoming_defer = true;
> @@ -104,6 +108,7 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestState *from,
>  
>  static void test_multifd_tcp_uadk(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_uadk;
>  
>      args->start.incoming_defer = true;
> @@ -156,6 +161,7 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestState *from,
>  
>  static void test_multifd_tcp_zlib(char *name, MigrateCommon *args)
>  {
> +    args->listen_uri = "tcp:127.0.0.1:0";
>      args->start_hook = migrate_hook_start_precopy_tcp_multifd_zlib;
>  
>      args->start.incoming_defer = true;
> diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
> index 75605d1791..4cc63bba7b 100644
> --- a/tests/qtest/migration/framework.c
> +++ b/tests/qtest/migration/framework.c
> @@ -837,6 +837,9 @@ int test_precopy_common(MigrateCommon *args)
>      QObject *out_channels = NULL;
>  
>      g_assert(!args->cpr_channel || args->connect_channels);
> +    if (args->start.incoming_defer) {
> +        g_assert(args->listen_uri || args->connect_channels);
> +    }
>  
>      if (migrate_start(&from, &to, args->listen_uri, &args->start)) {
>          return -1;
> @@ -846,6 +849,14 @@ int test_precopy_common(MigrateCommon *args)
>          data_hook = args->start_hook(from, to);
>      }
>  
> +    if (args->start.incoming_defer && !args->start.defer_target_connect) {
> +        if (args->connect_channels) {
> +            in_channels = qobject_from_json(args->connect_channels,
> +                                            &error_abort);
> +        }
> +        migrate_incoming_qmp(to, args->listen_uri, in_channels, "{}");
> +    }
> +
>      /* Wait for the first serial output from the source */
>      if (args->result == MIG_TEST_SUCCEED) {
>          wait_for_serial("src_serial");
> @@ -1077,9 +1088,6 @@ void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from,
>      migrate_set_parameter_str(from, "multifd-compression", method);
>      migrate_set_parameter_str(to, "multifd-compression", method);
>  
> -    /* Start incoming migration from the 1st socket */
> -    migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}");
> -
>      return NULL;
>  }
>  
> diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c
> index 31fd4af1ad..d2302ed692 100644
> --- a/tests/qtest/migration/precopy-tests.c
> +++ b/tests/qtest/migration/precopy-tests.c
> @@ -239,9 +239,6 @@ static void *migrate_hook_start_fd(QTestState *from,
>                                   "  'arguments': { 'fdname': 'fd-mig' }}");
>      close(pair[0]);
>  
> -    /* Start incoming migration from the 1st socket */
> -    migrate_incoming_qmp(to, "fd:fd-mig", NULL, "{}");
> -
>      /* Send the 2nd socket to the target */
>      qtest_qmp_fds_assert_success(from, &pair[1], 1,
>                                   "{ 'execute': 'getfd',"
> @@ -283,6 +280,7 @@ static void migrate_hook_end_fd(QTestState *from,
>  static void test_precopy_fd_socket(char *name, MigrateCommon *args)
>  {
>      args->connect_uri = "fd:fd-mig";
> +    args->listen_uri = "fd:fd-mig";
>      args->start_hook = migrate_hook_start_fd;
>      args->end_hook = migrate_hook_end_fd;
>  
> @@ -443,6 +441,7 @@ static void test_multifd_tcp_uri_none(char *name, MigrateCommon *args)
>       * everything will work alright even if guest page is changing.
>       */
>      args->live = true;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -459,6 +458,7 @@ static void test_multifd_tcp_zero_page_legacy(char *name, MigrateCommon *args)
>       * everything will work alright even if guest page is changing.
>       */
>      args->live = true;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -475,6 +475,7 @@ static void test_multifd_tcp_no_zero_page(char *name, MigrateCommon *args)
>       * everything will work alright even if guest page is changing.
>       */
>      args->live = true;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-tests.c
> index 40a78bd2d2..f636802642 100644
> --- a/tests/qtest/migration/tls-tests.c
> +++ b/tests/qtest/migration/tls-tests.c
> @@ -675,6 +675,7 @@ static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args)
>  {
>      args->start_hook = migrate_hook_start_multifd_tcp_tls_psk_match;
>      args->end_hook = migrate_hook_end_tls_psk;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -687,6 +688,7 @@ static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *args)
>      args->start_hook = migrate_hook_start_multifd_tcp_tls_psk_mismatch;
>      args->end_hook = migrate_hook_end_tls_psk;
>      args->result = MIG_TEST_FAIL;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.hide_stderr = true;
>      args->start.incoming_defer = true;
> @@ -700,6 +702,7 @@ static void test_multifd_postcopy_tcp_tls_psk_match(char *name,
>  {
>      args->start_hook = migrate_hook_start_multifd_tcp_tls_psk_match;
>      args->end_hook = migrate_hook_end_tls_psk;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -714,6 +717,7 @@ static void test_multifd_tcp_tls_x509_default_host(char *name,
>  {
>      args->start_hook = migrate_hook_start_multifd_tls_x509_default_host;
>      args->end_hook = migrate_hook_end_tls_x509;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -726,6 +730,7 @@ static void test_multifd_tcp_tls_x509_override_host(char *name,
>  {
>      args->start_hook = migrate_hook_start_multifd_tls_x509_override_host;
>      args->end_hook = migrate_hook_end_tls_x509;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -752,6 +757,7 @@ static void test_multifd_tcp_tls_x509_mismatch_host(char *name,
>      args->start_hook = migrate_hook_start_multifd_tls_x509_mismatch_host;
>      args->end_hook = migrate_hook_end_tls_x509;
>      args->result = MIG_TEST_FAIL;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.hide_stderr = true;
> @@ -765,6 +771,7 @@ static void test_multifd_tcp_tls_x509_allow_anon_client(char *name,
>  {
>      args->start_hook = migrate_hook_start_multifd_tls_x509_allow_anon_client;
>      args->end_hook = migrate_hook_end_tls_x509;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
> @@ -778,6 +785,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_client(char *name,
>      args->start_hook = migrate_hook_start_multifd_tls_x509_reject_anon_client;
>      args->end_hook = migrate_hook_end_tls_x509;
>      args->result = MIG_TEST_FAIL;
> +    args->listen_uri = "tcp:127.0.0.1:0";
>  
>      args->start.incoming_defer = true;
>      args->start.hide_stderr = true;


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-03-10 15:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 13:55 [PATCH 1/8] tests/qtest/migration: Fix leak of migration tests data Fabiano Rosas
2026-03-10 13:55 ` [PATCH 2/8] tests/qtest/migration: Change validate_uuid test to not trigger exit(1) Fabiano Rosas
2026-03-10 19:59   ` Peter Xu
2026-03-11 10:34   ` Prasad Pandit
2026-03-10 13:55 ` [PATCH 3/8] tests/qtest/migration: Fix misuse of listen_uri Fabiano Rosas
2026-03-10 15:48   ` Lukas Straub
2026-03-10 13:55 ` [PATCH 4/8] tests/qtest/migration: Stop invoking migrate_incoming from hooks Fabiano Rosas
2026-03-10 15:47   ` Lukas Straub [this message]
2026-03-10 13:55 ` [PATCH 5/8] tests/qtest/migration: Force exit-on-error=false when appropriate Fabiano Rosas
2026-03-10 20:46   ` Peter Xu
2026-03-10 21:14     ` Fabiano Rosas
2026-03-11 10:36       ` Prasad Pandit
2026-03-11 15:40       ` Peter Xu
2026-03-10 13:55 ` [PATCH 6/8] io: Fix TLS bye task leak Fabiano Rosas
2026-03-10 14:29   ` Daniel P. Berrangé
2026-03-10 13:55 ` [PATCH 7/8] tests/qtest/migration: Fix leak in CPR exec test Fabiano Rosas
2026-03-10 20:46   ` Peter Xu
2026-03-11  9:56   ` Prasad Pandit
2026-03-10 13:55 ` [PATCH 8/8] migration/multifd: Fix leaks of TLS error objects Fabiano Rosas
2026-03-10 20:49   ` Peter Xu
2026-03-11  9:32   ` Prasad Pandit
2026-03-10 19:47 ` [PATCH 1/8] tests/qtest/migration: Fix leak of migration tests data Peter Xu
2026-03-11 11:56 ` Prasad Pandit
2026-03-11 12:57   ` Fabiano Rosas

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=20260310164753.1f71bebd@penguin \
    --to=lukasstraub2@web.de \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.