qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steve Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Eduardo Habkost <eduardo@habkost.net>,
	Philippe Mathieu-Daude <philmd@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Steve Sistare <steven.sistare@oracle.com>
Subject: [PATCH V3 14/16] tests/migration-test: defer connection
Date: Fri,  1 Nov 2024 06:47:53 -0700	[thread overview]
Message-ID: <1730468875-249970-15-git-send-email-steven.sistare@oracle.com> (raw)
In-Reply-To: <1730468875-249970-1-git-send-email-steven.sistare@oracle.com>

Add an option to defer connection to the target monitor, needed by the
cpr-transfer test.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 tests/qtest/migration-test.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index d359b10..dfeb8d2 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -614,6 +614,9 @@ typedef struct {
      * size is plugged in.  If omitted, "-m %s" is used.
      */
     const char *memory_backend;
+
+    /* Do not connect to target monitor and qtest sockets in qtest_init */
+    bool defer_target_connect;
 } MigrateStart;
 
 /*
@@ -733,6 +736,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
     const char *machine_alias, *machine_opts = "";
     g_autofree char *machine = NULL;
     g_autofree char *memory_backend = NULL;
+    const char *events;
 
     if (args->use_shmem) {
         if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
@@ -850,22 +854,31 @@ static int test_migrate_start(QTestState **from, QTestState **to,
                                      &src_state);
     }
 
+    /*
+     * If the monitor connection is deferred, enable events on the command line
+     * so none are missed.  This is for testing only, do not set migration
+     * options like this in general.
+     */
+    events = args->defer_target_connect ? "-global migration.x-events=on" : "";
+
     cmd_target = g_strdup_printf("-accel kvm%s -accel tcg "
                                  "-machine %s,%s "
                                  "-name target,debug-threads=on "
                                  "%s "
                                  "-serial file:%s/dest_serial "
                                  "-incoming %s "
-                                 "%s %s %s %s %s",
+                                 "%s %s %s %s %s %s",
                                  kvm_opts ? kvm_opts : "",
                                  machine, machine_opts,
                                  memory_backend, tmpfs, uri,
+                                 events,
                                  arch_opts ? arch_opts : "",
                                  arch_target ? arch_target : "",
                                  shmem_opts ? shmem_opts : "",
                                  args->opts_target ? args->opts_target : "",
                                  ignore_stderr);
-    *to = qtest_init_with_env(QEMU_ENV_DST, cmd_target, false);
+    *to = qtest_init_with_env(QEMU_ENV_DST, cmd_target,
+                              args->defer_target_connect);
     qtest_qmp_set_event_callback(*to,
                                  migrate_watch_for_events,
                                  &dst_state);
@@ -883,7 +896,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
      * to mimic as closer as that.
      */
     migrate_set_capability(*from, "events", true);
-    migrate_set_capability(*to, "events", true);
+    if (!args->defer_target_connect) {
+        migrate_set_capability(*to, "events", true);
+    }
 
     return 0;
 }
@@ -1751,6 +1766,11 @@ static void test_precopy_common(MigrateCommon *args)
 
     migrate_qmp(from, to, args->connect_uri, args->connect_channels, "{}");
 
+    if (args->start.defer_target_connect) {
+        qtest_connect_deferred(to);
+        qtest_qmp_handshake(to);
+    }
+
     if (args->result != MIG_TEST_SUCCEED) {
         bool allow_active = args->result == MIG_TEST_FAIL;
         wait_for_migration_fail(from, allow_active);
-- 
1.8.3.1



  parent reply	other threads:[~2024-11-01 13:50 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 13:47 [PATCH V3 00/16] Live update: cpr-transfer Steve Sistare
2024-11-01 13:47 ` [PATCH V3 01/16] machine: anon-alloc option Steve Sistare
2024-11-01 14:06   ` Peter Xu
2024-11-04 10:39   ` David Hildenbrand
2024-11-04 10:45     ` David Hildenbrand
2024-11-04 17:38     ` Steven Sistare
2024-11-04 19:51       ` David Hildenbrand
2024-11-04 20:14         ` Peter Xu
2024-11-04 20:17           ` David Hildenbrand
2024-11-04 20:41             ` Peter Xu
2024-11-04 20:15         ` David Hildenbrand
2024-11-04 20:56           ` Steven Sistare
2024-11-04 21:36             ` David Hildenbrand
2024-11-06 20:12               ` Steven Sistare
2024-11-06 20:41                 ` Peter Xu
2024-11-06 20:59                   ` Steven Sistare
2024-11-06 21:21                     ` Peter Xu
2024-11-07 14:03                       ` Steven Sistare
2024-11-07 13:05                     ` David Hildenbrand
2024-11-07 14:04                       ` Steven Sistare
2024-11-07 16:19                         ` David Hildenbrand
2024-11-07 18:13                           ` Steven Sistare
2024-11-07 16:32                         ` Peter Xu
2024-11-07 16:38                           ` David Hildenbrand
2024-11-07 17:48                             ` Peter Xu
2024-11-07 13:23                 ` David Hildenbrand
2024-11-07 16:02                   ` Steven Sistare
2024-11-07 16:26                     ` David Hildenbrand
2024-11-07 16:40                       ` Steven Sistare
2024-11-08 11:31                         ` David Hildenbrand
2024-11-08 13:43                           ` Peter Xu
2024-11-08 14:14                             ` Steven Sistare
2024-11-08 14:32                               ` Peter Xu
2024-11-08 14:18                             ` David Hildenbrand
2024-11-08 15:01                               ` Peter Xu
2024-11-08 13:56                           ` Steven Sistare
2024-11-08 14:20                             ` David Hildenbrand
2024-11-08 14:37                               ` Steven Sistare
2024-11-08 14:54                                 ` David Hildenbrand
2024-11-08 15:07                                   ` Peter Xu
2024-11-08 15:09                                     ` David Hildenbrand
2024-11-08 15:15                                   ` David Hildenbrand
2024-11-01 13:47 ` [PATCH V3 02/16] migration: cpr-state Steve Sistare
2024-11-13 20:36   ` Peter Xu
2024-11-01 13:47 ` [PATCH V3 03/16] physmem: preserve ram blocks for cpr Steve Sistare
2024-11-01 13:47 ` [PATCH V3 04/16] hostmem-memfd: preserve " Steve Sistare
2024-11-01 13:47 ` [PATCH V3 05/16] migration: SCM_RIGHTS for QEMUFile Steve Sistare
2024-11-13 20:54   ` Peter Xu
2024-11-14 18:34     ` Steven Sistare
2024-11-01 13:47 ` [PATCH V3 06/16] migration: VMSTATE_FD Steve Sistare
2024-11-13 20:55   ` Peter Xu
2024-11-01 13:47 ` [PATCH V3 07/16] migration: cpr-transfer save and load Steve Sistare
2024-11-01 13:47 ` [PATCH V3 08/16] migration: cpr-uri parameter Steve Sistare
2024-11-01 13:47 ` [PATCH V3 09/16] migration: cpr-uri option Steve Sistare
2024-11-01 13:47 ` [PATCH V3 10/16] migration: split qmp_migrate Steve Sistare
2024-11-13 21:11   ` Peter Xu
2024-11-14 18:33     ` Steven Sistare
2024-11-01 13:47 ` [PATCH V3 11/16] migration: cpr-transfer mode Steve Sistare
2024-11-13 21:58   ` Peter Xu
2024-11-14 18:36     ` Steven Sistare
2024-11-14 19:04       ` Peter Xu
2024-11-19 19:50         ` Steven Sistare
2024-11-19 20:16           ` Peter Xu
2024-11-19 20:32             ` Steven Sistare
2024-11-19 20:51               ` Peter Xu
2024-11-19 21:03                 ` Steven Sistare
2024-11-19 21:29                   ` Peter Xu
2024-11-19 21:41                     ` Steven Sistare
2024-11-19 21:48                       ` Peter Xu
2024-11-19 21:51                         ` Steven Sistare
2024-11-20  9:38               ` Daniel P. Berrangé
2024-11-20 16:12                 ` Steven Sistare
2024-11-20 16:26                   ` Daniel P. Berrangé
2024-11-01 13:47 ` [PATCH V3 12/16] tests/migration-test: memory_backend Steve Sistare
2024-11-13 22:19   ` Fabiano Rosas
2024-11-01 13:47 ` [PATCH V3 13/16] tests/qtest: defer connection Steve Sistare
2024-11-13 22:36   ` Fabiano Rosas
2024-11-14 18:45     ` Steven Sistare
2024-11-13 22:53   ` Peter Xu
2024-11-14 18:31     ` Steven Sistare
2024-11-01 13:47 ` Steve Sistare [this message]
2024-11-14 12:46   ` [PATCH V3 14/16] tests/migration-test: " Fabiano Rosas
2024-11-01 13:47 ` [PATCH V3 15/16] migration-test: cpr-transfer Steve Sistare
2024-11-01 13:47 ` [PATCH V3 16/16] migration: cpr-transfer documentation Steve Sistare
2024-11-13 22:02   ` Peter Xu
2024-11-14 18:31     ` Steven Sistare

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=1730468875-249970-15-git-send-email-steven.sistare@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@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).