qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH v2 11/11] tests/migration-test: Add a test for postcopy hangs during RECOVER
Date: Wed, 13 Sep 2023 10:38:18 -0400	[thread overview]
Message-ID: <ZQHJWrX85YY9pjVM@x1n> (raw)
In-Reply-To: <87wmwujghq.fsf@suse.de>

On Wed, Sep 13, 2023 at 11:27:13AM -0300, Fabiano Rosas wrote:
> Peter Xu <peterx@redhat.com> writes:
> 
> >  
> > +static void wait_for_postcopy_status(QTestStatus *one, const char *status)
> > +{
> 
> QTestState *who
> 
> > +    wait_for_migration_status(from, status,
> 
> s/from/who
> 
> > +                              (const char * []) { "failed", "active",
> > +                                                  "completed", NULL });
> > +}
> > +
> > +static void postcopy_recover_fail(QTestState *from, QTestState *to)
> > +{
> > +    int ret, pair1[2], pair2[2];
> > +    char c;
> > +
> > +    /* Create two unrelated socketpairs */
> > +    ret = qemu_socketpair(PF_LOCAL, SOCK_STREAM, 0, pair1);
> > +    g_assert_cmpint(ret, ==, 0);
> > +
> > +    ret = qemu_socketpair(PF_LOCAL, SOCK_STREAM, 0, pair2);
> > +    g_assert_cmpint(ret, ==, 0);
> > +
> > +    /*
> > +     * Give the guests unpaired ends of the sockets, so they'll all blocked
> > +     * at reading.  This mimics a wrong channel established.
> > +     */
> > +    qtest_qmp_fds_assert_success(from, &pair1[0], 1,
> > +                                 "{ 'execute': 'getfd',"
> > +                                 "  'arguments': { 'fdname': 'fd-mig' }}");
> > +    qtest_qmp_fds_assert_success(to, &pair2[0], 1,
> > +                                 "{ 'execute': 'getfd',"
> > +                                 "  'arguments': { 'fdname': 'fd-mig' }}");
> > +
> > +    /*
> > +     * Write the 1st byte as QEMU_VM_COMMAND (0x8) for the dest socket, to
> > +     * emulate the 1st byte of a real recovery, but stops from there to
> > +     * keep dest QEMU in RECOVER.  This is needed so that we can kick off
> > +     * the recover process on dest QEMU (by triggering the G_IO_IN event).
> > +     *
> > +     * NOTE: this trick is not needed on src QEMUs, because src doesn't
> > +     * rely on an pre-existing G_IO_IN event, so it will always trigger the
> > +     * upcoming recovery anyway even if it can read nothing.
> > +     */
> > +#define QEMU_VM_COMMAND              0x08
> > +    c = QEMU_VM_COMMAND;
> > +    ret = send(pair2[1], &c, 1, 0);
> > +    g_assert_cmpint(ret, ==, 1);
> > +
> > +    migrate_recover(to, "fd:fd-mig");
> > +    migrate_qmp(from, "fd:fd-mig", "{'resume': true}");
> > +
> > +    /*
> > +     * Make sure both QEMU instances will go into RECOVER stage, then test
> > +     * kicking them out using migrate-pause.
> > +     */
> > +    wait_for_postcopy_status(from, "postcopy-recover")
> 
> semicolon

Sorry, I forgot to amend into this patch when I last touched the
bits.. here's the diff I'll amend into it:

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 6105c2da65..de5aa90483 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1358,9 +1358,9 @@ static void test_postcopy_preempt_tls_psk(void)
 }
 #endif
 
-static void wait_for_postcopy_status(QTestStatus *one, const char *status)
+static void wait_for_postcopy_status(QTestState *one, const char *status)
 {
-    wait_for_migration_status(from, status,
+    wait_for_migration_status(one, status,
                               (const char * []) { "failed", "active",
                                                   "completed", NULL });
 }
@@ -1410,7 +1410,7 @@ static void postcopy_recover_fail(QTestState *from, QTestState *to)
      * Make sure both QEMU instances will go into RECOVER stage, then test
      * kicking them out using migrate-pause.
      */
-    wait_for_postcopy_status(from, "postcopy-recover")
+    wait_for_postcopy_status(from, "postcopy-recover");
     wait_for_postcopy_status(to, "postcopy-recover");
 
     /*

-- 
Peter Xu



      reply	other threads:[~2023-09-13 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 22:21 [PATCH v2 00/11] migration: Better error handling in rp thread, allow failures in recover Peter Xu
2023-09-12 22:21 ` [PATCH v2 01/11] migration: Display error in query-migrate irrelevant of status Peter Xu
2023-09-12 22:21 ` [PATCH v2 02/11] migration: Let migrate_set_error() take ownership Peter Xu
2023-09-13 13:32   ` Fabiano Rosas
2023-09-12 22:21 ` [PATCH v2 03/11] migration: Introduce migrate_has_error() Peter Xu
2023-09-12 22:21 ` [PATCH v2 04/11] migration: Refactor error handling in source return path Peter Xu
2023-09-12 22:21 ` [PATCH v2 05/11] migration: Deliver return path file error to migrate state too Peter Xu
2023-09-12 22:21 ` [PATCH v2 06/11] qemufile: Always return a verbose error Peter Xu
2023-09-12 22:21 ` [PATCH v2 07/11] migration: Remember num of ramblocks to sync during recovery Peter Xu
2023-09-12 22:21 ` [PATCH v2 08/11] migration: Add migration_rp_wait|kick() Peter Xu
2023-09-12 22:21 ` [PATCH v2 09/11] migration: Allow network to fail even during recovery Peter Xu
2023-09-13 13:36   ` Fabiano Rosas
2023-09-12 22:21 ` [PATCH v2 10/11] migration: Allow RECOVER->PAUSED convertion for dest qemu Peter Xu
2023-09-13 13:37   ` Fabiano Rosas
2023-09-12 22:21 ` [PATCH v2 11/11] tests/migration-test: Add a test for postcopy hangs during RECOVER Peter Xu
2023-09-13 14:27   ` Fabiano Rosas
2023-09-13 14:38     ` Peter Xu [this message]

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=ZQHJWrX85YY9pjVM@x1n \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).