From: Nikolay Borisov <nbori...@suse.com> 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.
Signed-off-by: Nikolay Borisov <nbori...@suse.com> Signed-off-by: Fabiano Rosas <faro...@suse.de> Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> --- tests/qtest/migration-helpers.c | 19 +++++++++++++++++++ tests/qtest/migration-helpers.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index f6f3c6680f..8161495c27 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -130,6 +130,25 @@ void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...) qobject_unref(rsp); } + +void migrate_incoming_qmp(QTestState *who, const char *uri, const char *fmt, ...) +{ + va_list ap; + QDict *args, *rsp; + + 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); + + rsp = qtest_qmp(who, "{ 'execute': 'migrate-incoming', 'arguments': %p}", args); + + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); +} + /* * Note: caller is responsible to free the returned object via * qobject_unref() after use diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index a188b62787..53ddeaebb7 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -31,6 +31,10 @@ QDict *qmp_command(QTestState *who, const char *command, ...); 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, ...); + QDict *migrate_query(QTestState *who); QDict *migrate_query_not_failed(QTestState *who); -- 2.35.3