[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V6 20/24] migration-test: defer connection
From: |
Steve Sistare |
Subject: |
[PATCH V6 20/24] migration-test: defer connection |
Date: |
Tue, 14 Jan 2025 09:23:50 -0800 |
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>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/framework.c | 23 ++++++++++++++++++++---
tests/qtest/migration/framework.h | 3 +++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/migration/framework.c
b/tests/qtest/migration/framework.c
index 44ff901..03640e4 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -211,6 +211,7 @@ int migrate_start(QTestState **from, QTestState **to, const
char *uri,
g_autofree char *machine = NULL;
const char *bootpath;
g_autofree char *memory_backend = NULL;
+ const char *events;
if (args->use_shmem) {
if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
@@ -327,21 +328,30 @@ int migrate_start(QTestState **from, QTestState **to,
const char *uri,
&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",
kvm_opts ? kvm_opts : "",
machine, machine_opts,
memory_backend, tmpfs, uri,
+ events,
arch_opts ? arch_opts : "",
shmem_opts ? shmem_opts : "",
args->opts_target ? args->opts_target : "",
ignore_stderr);
- *to = qtest_init_with_env(QEMU_ENV_DST, cmd_target, true);
+ *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);
@@ -359,7 +369,9 @@ int migrate_start(QTestState **from, QTestState **to, const
char *uri,
* 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;
}
@@ -713,6 +725,11 @@ void test_precopy_common(MigrateCommon *args)
migrate_qmp(from, to, args->connect_uri, args->connect_channels, "{}");
+ if (args->start.defer_target_connect) {
+ qtest_connect(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);
diff --git a/tests/qtest/migration/framework.h
b/tests/qtest/migration/framework.h
index d368fcf..1341368 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -114,6 +114,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;
typedef enum PostcopyRecoveryFailStage {
--
1.8.3.1
- Re: [PATCH V6 03/24] physmem: qemu_ram_alloc_from_fd extensions, (continued)
- [PATCH V6 02/24] physmem: fix qemu_ram_alloc_from_fd size calculation, Steve Sistare, 2025/01/14
- [PATCH V6 04/24] physmem: fd-based shared memory, Steve Sistare, 2025/01/14
- [PATCH V6 07/24] migration: cpr-state, Steve Sistare, 2025/01/14
- [PATCH V6 06/24] machine: aux-ram-share option, Steve Sistare, 2025/01/14
- [PATCH V6 09/24] hostmem-memfd: preserve for cpr, Steve Sistare, 2025/01/14
- [PATCH V6 08/24] physmem: preserve ram blocks for cpr, Steve Sistare, 2025/01/14
- [PATCH V6 10/24] hostmem-shm: preserve for cpr, Steve Sistare, 2025/01/14
- [PATCH V6 18/24] tests/qtest: optimize migrate_set_ports, Steve Sistare, 2025/01/14
- [PATCH V6 12/24] migration: incoming channel, Steve Sistare, 2025/01/14
- [PATCH V6 20/24] migration-test: defer connection,
Steve Sistare <=
- [PATCH V6 24/24] migration: cpr-transfer documentation, Steve Sistare, 2025/01/14
- [PATCH V6 11/24] migration: enhance migrate_uri_parse, Steve Sistare, 2025/01/14
- [PATCH V6 22/24] tests/qtest: assert qmp connected, Steve Sistare, 2025/01/14
- [PATCH V6 16/24] migration: cpr-transfer mode, Steve Sistare, 2025/01/14
- [PATCH V6 13/24] migration: SCM_RIGHTS for QEMUFile, Steve Sistare, 2025/01/14
- [PATCH V6 17/24] migration-test: memory_backend, Steve Sistare, 2025/01/14
- [PATCH V6 14/24] migration: VMSTATE_FD, Steve Sistare, 2025/01/14
- [PATCH V6 15/24] migration: cpr-transfer save and load, Steve Sistare, 2025/01/14
- [PATCH V6 21/24] tests/qtest: enhance migration channels, Steve Sistare, 2025/01/14