2019-12-16 13:59:44 +03:00
|
|
|
/*
|
|
|
|
* QTest migration helpers
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates
|
|
|
|
* based on the vhost-user-test.c that is:
|
|
|
|
* Copyright (c) 2014 Virtual Open Systems Sarl.
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
2022-05-06 16:49:09 +03:00
|
|
|
|
|
|
|
#ifndef MIGRATION_HELPERS_H
|
|
|
|
#define MIGRATION_HELPERS_H
|
2019-12-16 13:59:44 +03:00
|
|
|
|
2022-03-30 12:39:05 +03:00
|
|
|
#include "libqtest.h"
|
2019-12-16 13:59:44 +03:00
|
|
|
|
2024-01-03 23:05:38 +03:00
|
|
|
typedef struct QTestMigrationState {
|
|
|
|
bool stop_seen;
|
|
|
|
bool resume_seen;
|
2024-01-03 23:05:40 +03:00
|
|
|
bool suspend_seen;
|
|
|
|
bool suspend_me;
|
2024-01-03 23:05:38 +03:00
|
|
|
} QTestMigrationState;
|
|
|
|
|
|
|
|
bool migrate_watch_for_events(QTestState *who, const char *name,
|
2023-06-01 19:13:44 +03:00
|
|
|
QDict *event, void *opaque);
|
2019-12-16 13:59:44 +03:00
|
|
|
|
2024-03-12 23:26:32 +03:00
|
|
|
G_GNUC_PRINTF(5, 6)
|
2024-03-12 23:26:27 +03:00
|
|
|
void migrate_qmp(QTestState *who, QTestState *to, const char *uri,
|
2024-03-12 23:26:32 +03:00
|
|
|
const char *channels, const char *fmt, ...);
|
2019-12-16 13:59:44 +03:00
|
|
|
|
2023-07-12 22:07:38 +03:00
|
|
|
G_GNUC_PRINTF(3, 4)
|
|
|
|
void migrate_incoming_qmp(QTestState *who, const char *uri,
|
|
|
|
const char *fmt, ...);
|
|
|
|
|
2024-03-12 23:26:30 +03:00
|
|
|
G_GNUC_PRINTF(4, 5)
|
|
|
|
void migrate_qmp_fail(QTestState *who, const char *uri,
|
|
|
|
const char *channels, const char *fmt, ...);
|
2023-07-12 22:07:41 +03:00
|
|
|
|
2023-07-12 22:07:37 +03:00
|
|
|
void migrate_set_capability(QTestState *who, const char *capability,
|
|
|
|
bool value);
|
|
|
|
|
2019-12-16 13:59:44 +03:00
|
|
|
QDict *migrate_query(QTestState *who);
|
2022-04-26 19:00:48 +03:00
|
|
|
QDict *migrate_query_not_failed(QTestState *who);
|
2019-12-16 13:59:44 +03:00
|
|
|
|
|
|
|
void wait_for_migration_status(QTestState *who,
|
|
|
|
const char *goal, const char **ungoals);
|
|
|
|
|
|
|
|
void wait_for_migration_complete(QTestState *who);
|
|
|
|
|
|
|
|
void wait_for_migration_fail(QTestState *from, bool allow_active);
|
|
|
|
|
2023-10-18 22:27:35 +03:00
|
|
|
char *find_common_machine_version(const char *mtype, const char *var1,
|
|
|
|
const char *var2);
|
2023-10-18 22:27:40 +03:00
|
|
|
char *resolve_machine_version(const char *alias, const char *var1,
|
|
|
|
const char *var2);
|
2024-06-17 21:57:28 +03:00
|
|
|
#ifdef O_DIRECT
|
|
|
|
bool probe_o_direct_support(const char *tmpfs);
|
|
|
|
#else
|
|
|
|
static inline bool probe_o_direct_support(const char *tmpfs)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2024-01-04 17:21:43 +03:00
|
|
|
void migration_test_add(const char *path, void (*fn)(void));
|
2024-06-20 01:30:44 +03:00
|
|
|
void migration_event_wait(QTestState *s, const char *target);
|
|
|
|
|
2022-05-06 16:49:09 +03:00
|
|
|
#endif /* MIGRATION_HELPERS_H */
|