2019-12-16 14:59:44 +04: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 15:49:09 +02:00
|
|
|
|
|
|
|
#ifndef MIGRATION_HELPERS_H
|
|
|
|
#define MIGRATION_HELPERS_H
|
2019-12-16 14:59:44 +04:00
|
|
|
|
2022-03-30 13:39:05 +04:00
|
|
|
#include "libqtest.h"
|
2019-12-16 14:59:44 +04:00
|
|
|
|
2024-01-03 12:05:38 -08:00
|
|
|
typedef struct QTestMigrationState {
|
|
|
|
bool stop_seen;
|
|
|
|
bool resume_seen;
|
2024-01-03 12:05:40 -08:00
|
|
|
bool suspend_seen;
|
|
|
|
bool suspend_me;
|
2024-01-03 12:05:38 -08:00
|
|
|
} QTestMigrationState;
|
|
|
|
|
|
|
|
bool migrate_watch_for_events(QTestState *who, const char *name,
|
2023-06-01 17:13:44 +01:00
|
|
|
QDict *event, void *opaque);
|
2019-12-16 14:59:44 +04:00
|
|
|
|
2024-03-12 20:26:32 +00:00
|
|
|
G_GNUC_PRINTF(5, 6)
|
2024-03-12 20:26:27 +00:00
|
|
|
void migrate_qmp(QTestState *who, QTestState *to, const char *uri,
|
2024-03-12 20:26:32 +00:00
|
|
|
const char *channels, const char *fmt, ...);
|
2019-12-16 14:59:44 +04:00
|
|
|
|
2023-07-12 16:07:38 -03:00
|
|
|
G_GNUC_PRINTF(3, 4)
|
|
|
|
void migrate_incoming_qmp(QTestState *who, const char *uri,
|
|
|
|
const char *fmt, ...);
|
|
|
|
|
2024-03-12 20:26:30 +00:00
|
|
|
G_GNUC_PRINTF(4, 5)
|
|
|
|
void migrate_qmp_fail(QTestState *who, const char *uri,
|
|
|
|
const char *channels, const char *fmt, ...);
|
2023-07-12 16:07:41 -03:00
|
|
|
|
2023-07-12 16:07:37 -03:00
|
|
|
void migrate_set_capability(QTestState *who, const char *capability,
|
|
|
|
bool value);
|
|
|
|
|
2019-12-16 14:59:44 +04:00
|
|
|
QDict *migrate_query(QTestState *who);
|
2022-04-26 17:00:48 +01:00
|
|
|
QDict *migrate_query_not_failed(QTestState *who);
|
2019-12-16 14:59:44 +04: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 16:27:35 -03:00
|
|
|
char *find_common_machine_version(const char *mtype, const char *var1,
|
|
|
|
const char *var2);
|
2023-10-18 16:27:40 -03:00
|
|
|
char *resolve_machine_version(const char *alias, const char *var1,
|
|
|
|
const char *var2);
|
2024-06-17 15: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 11:21:43 -03:00
|
|
|
void migration_test_add(const char *path, void (*fn)(void));
|
2024-06-19 18:30:44 -04:00
|
|
|
void migration_event_wait(QTestState *s, const char *target);
|
|
|
|
|
2022-05-06 15:49:09 +02:00
|
|
|
#endif /* MIGRATION_HELPERS_H */
|