From: Fabiano Rosas <farosas@suse.de>
To: Het Gala <het.gala@nutanix.com>, qemu-devel@nongnu.org
Cc: thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com,
peterx@redhat.com, prerna.saxena@nutanix.com,
Het Gala <het.gala@nutanix.com>
Subject: Re: [PATCH 3/4] tests/qtest/migration: Add channels parameter in migrate_incoming_qmp
Date: Wed, 10 Apr 2024 10:14:47 -0300 [thread overview]
Message-ID: <87y19ltl4o.fsf@suse.de> (raw)
In-Reply-To: <20240410111541.188504-4-het.gala@nutanix.com>
Het Gala <het.gala@nutanix.com> writes:
> Alter migrate_incoming_qmp() to allow both uri and channels
> independently. For channels, convert string to a QDict.
>
> Signed-off-by: Het Gala <het.gala@nutanix.com>
> ---
> tests/qtest/migration-helpers.c | 13 +++++++++++--
> tests/qtest/migration-helpers.h | 4 ++--
> tests/qtest/migration-test.c | 12 ++++++------
> tests/qtest/virtio-net-failover.c | 8 ++++----
> 4 files changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
> index 3b72cad6c1..cbd91719ae 100644
> --- a/tests/qtest/migration-helpers.c
> +++ b/tests/qtest/migration-helpers.c
> @@ -245,7 +245,8 @@ void migrate_set_capability(QTestState *who, const char *capability,
> capability, value);
> }
>
> -void migrate_incoming_qmp(QTestState *to, const char *uri, const char *fmt, ...)
> +void migrate_incoming_qmp(QTestState *to, const char *uri,
> + const char *channels, const char *fmt, ...)
> {
> va_list ap;
> QDict *args, *rsp, *data;
> @@ -255,7 +256,15 @@ void migrate_incoming_qmp(QTestState *to, const char *uri, const char *fmt, ...)
> va_end(ap);
>
> g_assert(!qdict_haskey(args, "uri"));
> - qdict_put_str(args, "uri", uri);
> + if (uri) {
> + qdict_put_str(args, "uri", uri);
> + }
> +
> + g_assert(!qdict_haskey(args, "channels"));
> + if (channels) {
> + QObject *channels_obj = qobject_from_json(channels, &error_abort);
> + qdict_put_obj(args, "channels", channels_obj);
> + }
Do you think it makes sense to have channels take precedence here? It
would make the next patch cleaner without having to check for channels
presence. I don't think we need a 'both' test for incoming.
>
> migrate_set_capability(to, "events", true);
>
> diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
> index 1339835698..9f74281aea 100644
> --- a/tests/qtest/migration-helpers.h
> +++ b/tests/qtest/migration-helpers.h
> @@ -29,9 +29,9 @@ G_GNUC_PRINTF(5, 6)
> void migrate_qmp(QTestState *who, QTestState *to, const char *uri,
> const char *channels, const char *fmt, ...);
>
> -G_GNUC_PRINTF(3, 4)
> +G_GNUC_PRINTF(4, 5)
> void migrate_incoming_qmp(QTestState *who, const char *uri,
> - const char *fmt, ...);
> + const char *channels, const char *fmt, ...);
>
> G_GNUC_PRINTF(4, 5)
> void migrate_qmp_fail(QTestState *who, const char *uri,
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index f2c27d611c..fa8a860811 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -1296,7 +1296,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
> migrate_ensure_non_converge(from);
>
> migrate_prepare_for_dirty_mem(from);
> - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", "{}");
> + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}");
>
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
> @@ -1824,7 +1824,7 @@ static void test_file_common(MigrateCommon *args, bool stop_src)
> * We need to wait for the source to finish before starting the
> * destination.
> */
> - migrate_incoming_qmp(to, args->connect_uri, "{}");
> + migrate_incoming_qmp(to, args->connect_uri, NULL, "{}");
> wait_for_migration_complete(to);
>
> if (stop_src) {
> @@ -2405,7 +2405,7 @@ static void *test_migrate_fd_start_hook(QTestState *from,
> close(pair[0]);
>
> /* Start incoming migration from the 1st socket */
> - migrate_incoming_qmp(to, "fd:fd-mig", "{}");
> + migrate_incoming_qmp(to, "fd:fd-mig", NULL, "{}");
>
> /* Send the 2nd socket to the target */
> qtest_qmp_fds_assert_success(from, &pair[1], 1,
> @@ -2715,7 +2715,7 @@ test_migrate_precopy_tcp_multifd_start_common(QTestState *from,
> migrate_set_capability(to, "multifd", true);
>
> /* Start incoming migration from the 1st socket */
> - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", "{}");
> + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}");
>
> return NULL;
> }
> @@ -3040,7 +3040,7 @@ static void test_multifd_tcp_cancel(void)
> migrate_set_capability(to, "multifd", true);
>
> /* Start incoming migration from the 1st socket */
> - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", "{}");
> + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}");
>
> /* Wait for the first serial output from the source */
> wait_for_serial("src_serial");
> @@ -3068,7 +3068,7 @@ static void test_multifd_tcp_cancel(void)
> migrate_set_capability(to2, "multifd", true);
>
> /* Start incoming migration from the 1st socket */
> - migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}");
> + migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}");
>
> wait_for_migration_status(from, "cancelled", NULL);
>
> diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c
> index 73dfabc272..e263ecd80e 100644
> --- a/tests/qtest/virtio-net-failover.c
> +++ b/tests/qtest/virtio-net-failover.c
> @@ -772,7 +772,7 @@ static void test_migrate_in(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, false, "primary0", MAC_PRIMARY0);
>
> - migrate_incoming_qmp(qts, uri, "{}");
> + migrate_incoming_qmp(qts, uri, NULL, "{}");
>
> resp = get_failover_negociated_event(qts);
> g_assert_cmpstr(qdict_get_str(resp, "device-id"), ==, "standby0");
> @@ -894,7 +894,7 @@ static void test_off_migrate_in(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, true, "primary0", MAC_PRIMARY0);
>
> - migrate_incoming_qmp(qts, uri, "{}");
> + migrate_incoming_qmp(qts, uri, NULL, "{}");
>
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, true, "primary0", MAC_PRIMARY0);
> @@ -1021,7 +1021,7 @@ static void test_guest_off_migrate_in(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, false, "primary0", MAC_PRIMARY0);
>
> - migrate_incoming_qmp(qts, uri, "{}");
> + migrate_incoming_qmp(qts, uri, NULL, "{}");
>
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, false, "primary0", MAC_PRIMARY0);
> @@ -1746,7 +1746,7 @@ static void test_multi_in(gconstpointer opaque)
> check_one_card(qts, true, "standby1", MAC_STANDBY1);
> check_one_card(qts, false, "primary1", MAC_PRIMARY1);
>
> - migrate_incoming_qmp(qts, uri, "{}");
> + migrate_incoming_qmp(qts, uri, NULL, "{}");
>
> resp = get_failover_negociated_event(qts);
> g_assert_cmpstr(qdict_get_str(resp, "device-id"), ==, "standby0");
next prev parent reply other threads:[~2024-04-10 13:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 11:15 [PATCH 0/4] tests/qtest/migration: Add postcopy qtests for introducing 'channels' argument with new QAPI syntax Het Gala
2024-04-10 11:15 ` [PATCH 1/4] Revert "migration: modify test_multifd_tcp_none() to use new QAPI syntax" Het Gala
2024-04-10 13:04 ` Fabiano Rosas
2024-04-10 14:53 ` Peter Xu
2024-04-11 14:15 ` Het Gala
2024-04-11 14:26 ` Peter Xu
2024-04-11 18:01 ` Het Gala
2024-04-11 18:42 ` Peter Xu
2024-04-11 19:41 ` Fabiano Rosas
2024-04-12 14:17 ` Peter Xu
2024-04-12 14:58 ` Fabiano Rosas
2024-04-12 21:09 ` Peter Xu
2024-04-11 12:30 ` Het Gala
2024-04-10 11:15 ` [PATCH 2/4] tests/qtest/migration: Replace 'migrate-incoming' qtest_qmp_assert_success with migrate_incoming_qmp Het Gala
2024-04-10 13:05 ` Fabiano Rosas
2024-04-10 11:15 ` [PATCH 3/4] tests/qtest/migration: Add channels parameter in migrate_incoming_qmp Het Gala
2024-04-10 13:14 ` Fabiano Rosas [this message]
2024-04-11 12:38 ` Het Gala
2024-04-10 11:15 ` [PATCH 4/4] tests/qtest/migration: Add postcopy migration qtests to use 'channels' argument instead of uri Het Gala
2024-04-10 13:15 ` Fabiano Rosas
2024-04-11 13:26 ` Het Gala
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=87y19ltl4o.fsf@suse.de \
--to=farosas@suse.de \
--cc=het.gala@nutanix.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=prerna.saxena@nutanix.com \
--cc=qemu-devel@nongnu.org \
--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).