1 /*
2 * QTest migration helpers
3 *
4 * Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates
5 * based on the vhost-user-test.c that is:
6 * Copyright (c) 2014 Virtual Open Systems Sarl.
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
10 *
11 */
12
13 #ifndef MIGRATION_UTIL_H
14 #define MIGRATION_UTIL_H
15
16 #include "libqtest.h"
17
18 typedef struct QTestMigrationState {
19 bool stop_seen;
20 bool resume_seen;
21 bool suspend_seen;
22 bool suspend_me;
23 } QTestMigrationState;
24
25 bool migrate_watch_for_events(QTestState *who, const char *name,
26 QDict *event, void *opaque);
27
28 QDict *migrate_query(QTestState *who);
29 QDict *migrate_query_not_failed(QTestState *who);
30
31 void wait_for_migration_status(QTestState *who,
32 const char *goal, const char **ungoals);
33
34 void wait_for_migration_complete(QTestState *who);
35
36 void wait_for_migration_fail(QTestState *from, bool allow_active);
37
38 char *find_common_machine_version(const char *mtype, const char *var1,
39 const char *var2);
40 char *resolve_machine_version(const char *alias, const char *var1,
41 const char *var2);
42 #ifdef O_DIRECT
43 bool probe_o_direct_support(const char *tmpfs);
44 #else
probe_o_direct_support(const char * tmpfs)45 static inline bool probe_o_direct_support(const char *tmpfs)
46 {
47 return false;
48 }
49 #endif
50
51 bool ufd_version_check(bool *uffd_feature_thread_id);
52 bool kvm_dirty_ring_supported(void);
53 void migration_test_add(const char *path, void (*fn)(void));
54 void migration_test_add_suffix(const char *path, const char *suffix,
55 void (*fn)(void *));
56 char *migrate_get_connect_uri(QTestState *who);
57 void migrate_set_ports(QTestState *to, QList *channel_list);
58
59 #endif /* MIGRATION_UTIL_H */
60