From: Thomas Huth <thuth@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH] tests/qtest: failover: fix infinite loop
Date: Tue, 29 Mar 2022 14:47:43 +0200 [thread overview]
Message-ID: <f329f744-e807-fc0c-69f6-52cc3d10ab9e@redhat.com> (raw)
In-Reply-To: <20220329124259.355995-1-lvivier@redhat.com>
On 29/03/2022 14.42, Laurent Vivier wrote:
> If the migration is over before we cancel it, we are
> waiting in a loop a state that never comes because the state
> is already "completed".
>
> To avoid an infinite loop, skip the test if the migration
> is "completed" before we were able to cancel it.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> tests/qtest/virtio-net-failover.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c
> index 80292eecf65f..78811f1c9216 100644
> --- a/tests/qtest/virtio-net-failover.c
> +++ b/tests/qtest/virtio-net-failover.c
> @@ -1141,6 +1141,11 @@ static void test_migrate_guest_off_abort(gconstpointer opaque)
> ret = migrate_status(qts);
>
> status = qdict_get_str(ret, "status");
> + if (strcmp(status, "completed") == 0) {
> + g_test_skip("Failed to cancel the migration");
> + qobject_unref(ret);
> + goto out;
> + }
> if (strcmp(status, "active") == 0) {
> qobject_unref(ret);
> break;
> @@ -1155,8 +1160,12 @@ static void test_migrate_guest_off_abort(gconstpointer opaque)
>
> while (true) {
> ret = migrate_status(qts);
> -
> status = qdict_get_str(ret, "status");
> + if (strcmp(status, "completed") == 0) {
> + g_test_skip("Failed to cancel the migration");
> + qobject_unref(ret);
> + goto out;
> + }
> if (strcmp(status, "cancelled") == 0) {
> qobject_unref(ret);
> break;
> @@ -1169,6 +1178,7 @@ static void test_migrate_guest_off_abort(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, false, "primary0", MAC_PRIMARY0);
>
> +out:
> qos_object_destroy((QOSGraphObject *)vdev);
> machine_stop(qts);
> }
> @@ -1251,8 +1261,7 @@ static void test_migrate_abort_wait_unplug(gconstpointer opaque)
> qobject_unref(ret);
> break;
> }
> - g_assert_cmpstr(status, !=, "failed");
> - g_assert_cmpstr(status, !=, "active");
> + g_assert_cmpstr(status, ==, "cancelling");
> qobject_unref(ret);
> }
>
> @@ -1324,11 +1333,11 @@ static void test_migrate_abort_active(gconstpointer opaque)
> ret = migrate_status(qts);
>
> status = qdict_get_str(ret, "status");
> + g_assert_cmpstr(status, !=, "failed");
> if (strcmp(status, "wait-unplug") != 0) {
> qobject_unref(ret);
> break;
> }
> - g_assert_cmpstr(status, !=, "failed");
> qobject_unref(ret);
> }
>
> @@ -1340,6 +1349,11 @@ static void test_migrate_abort_active(gconstpointer opaque)
> ret = migrate_status(qts);
>
> status = qdict_get_str(ret, "status");
> + if (strcmp(status, "completed") == 0) {
> + g_test_skip("Failed to cancel the migration");
> + qobject_unref(ret);
> + goto out;
> + }
> if (strcmp(status, "cancelled") == 0) {
> qobject_unref(ret);
> break;
> @@ -1352,6 +1366,7 @@ static void test_migrate_abort_active(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, true, "primary0", MAC_PRIMARY0);
>
> +out:
> qos_object_destroy((QOSGraphObject *)vdev);
> machine_stop(qts);
> }
> @@ -1425,6 +1440,11 @@ static void test_migrate_off_abort(gconstpointer opaque)
> ret = migrate_status(qts);
>
> status = qdict_get_str(ret, "status");
> + if (strcmp(status, "completed") == 0) {
> + g_test_skip("Failed to cancel the migration");
> + qobject_unref(ret);
> + goto out;
> + }
> if (strcmp(status, "cancelled") == 0) {
> qobject_unref(ret);
> break;
> @@ -1437,6 +1457,7 @@ static void test_migrate_off_abort(gconstpointer opaque)
> check_one_card(qts, true, "standby0", MAC_STANDBY0);
> check_one_card(qts, true, "primary0", MAC_PRIMARY0);
>
> +out:
> qos_object_destroy((QOSGraphObject *)vdev);
> machine_stop(qts);
> }
Acked-by: Thomas Huth <thuth@redhat.com>
Is this still urgent for 7.0, or can it wait for the 7.1 cycle?
Thomas
next prev parent reply other threads:[~2022-03-29 12:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 12:42 [PATCH] tests/qtest: failover: fix infinite loop Laurent Vivier
2022-03-29 12:47 ` Thomas Huth [this message]
2022-03-29 13:23 ` Peter Maydell
2022-03-29 13:25 ` Thomas Huth
2022-03-29 13:27 ` Peter Maydell
2022-03-29 13:28 ` Thomas Huth
2022-03-29 18:13 ` Peter Maydell
2022-04-04 17:48 ` Dr. David Alan Gilbert
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=f329f744-e807-fc0c-69f6-52cc3d10ab9e@redhat.com \
--to=thuth@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 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).