[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/65] tests/qtest: migration: Add migrate_incoming_qmp helper
|
From: |
Juan Quintela |
|
Subject: |
[PULL 03/65] tests/qtest: migration: Add migrate_incoming_qmp helper |
|
Date: |
Wed, 11 Oct 2023 11:21:01 +0200 |
From: Fabiano Rosas <farosas@suse.de>
file-based migration requires the target to initiate its migration after
the source has finished writing out the data in the file. Currently
there's no easy way to initiate 'migrate-incoming', allow this by
introducing migrate_incoming_qmp helper, similarly to migrate_qmp.
Also make sure migration events are enabled and wait for the incoming
migration to start before returning. This avoid a race when querying
the migration status too soon after issuing the command.
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230712190742.22294-3-farosas@suse.de>
---
tests/qtest/migration-helpers.h | 4 ++++
tests/qtest/migration-helpers.c | 29 +++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index 484d7c960f..57d295a4fe 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -23,6 +23,10 @@ bool migrate_watch_for_resume(QTestState *who, const char
*name,
G_GNUC_PRINTF(3, 4)
void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...);
+G_GNUC_PRINTF(3, 4)
+void migrate_incoming_qmp(QTestState *who, const char *uri,
+ const char *fmt, ...);
+
void migrate_set_capability(QTestState *who, const char *capability,
bool value);
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 2df198c99e..08f5ee1179 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -81,6 +81,35 @@ void migrate_set_capability(QTestState *who, const char
*capability,
capability, value);
}
+void migrate_incoming_qmp(QTestState *to, const char *uri, const char *fmt,
...)
+{
+ va_list ap;
+ QDict *args, *rsp, *data;
+
+ va_start(ap, fmt);
+ args = qdict_from_vjsonf_nofail(fmt, ap);
+ va_end(ap);
+
+ g_assert(!qdict_haskey(args, "uri"));
+ qdict_put_str(args, "uri", uri);
+
+ migrate_set_capability(to, "events", true);
+
+ rsp = qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %p}",
+ args);
+ g_assert(qdict_haskey(rsp, "return"));
+ qobject_unref(rsp);
+
+ rsp = qtest_qmp_eventwait_ref(to, "MIGRATION");
+ g_assert(qdict_haskey(rsp, "data"));
+
+ data = qdict_get_qdict(rsp, "data");
+ g_assert(qdict_haskey(data, "status"));
+ g_assert_cmpstr(qdict_get_str(data, "status"), ==, "setup");
+
+ qobject_unref(rsp);
+}
+
/*
* Note: caller is responsible to free the returned object via
* qobject_unref() after use
--
2.41.0
- [PULL 00/65] Migration 20231011 patches, Juan Quintela, 2023/10/11
- [PULL 01/65] migration/qmp: Fix crash on setting tls-authz with null, Juan Quintela, 2023/10/11
- [PULL 04/65] tests/qtest: migration: Use migrate_incoming_qmp where appropriate, Juan Quintela, 2023/10/11
- [PULL 07/65] migration: Allow RECOVER->PAUSED convertion for dest qemu, Juan Quintela, 2023/10/11
- [PULL 03/65] tests/qtest: migration: Add migrate_incoming_qmp helper,
Juan Quintela <=
- [PULL 06/65] tests/qtest: migration: Add support for negative testing of qmp_migrate, Juan Quintela, 2023/10/11
- [PULL 02/65] tests/qtest: migration: Expose migrate_set_capability, Juan Quintela, 2023/10/11
- [PULL 09/65] migration/rdma: Clean up qemu_rdma_data_init()'s return type, Juan Quintela, 2023/10/11
- [PULL 10/65] migration/rdma: Clean up rdma_delete_block()'s return type, Juan Quintela, 2023/10/11
- [PULL 05/65] migration: Set migration status early in incoming side, Juan Quintela, 2023/10/11
- [PULL 08/65] migration/rdma: Clean up qemu_rdma_poll()'s return type, Juan Quintela, 2023/10/11
- [PULL 13/65] migration/rdma: Fix unwanted integer truncation, Juan Quintela, 2023/10/11