| 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 | #include "migration/framework.h" |
| 19 | |
| 20 | typedef struct QTestMigrationState { |
| 21 | bool stop_seen; |
| 22 | bool resume_seen; |
| 23 | bool suspend_seen; |
| 24 | bool suspend_me; |
| 25 | } QTestMigrationState; |
| 26 | |
| 27 | bool migrate_watch_for_events(QTestState *who, const char *name, |
| 28 | QDict *event, void *opaque); |
| 29 | |
| 30 | QDict *migrate_query(QTestState *who); |
| 31 | QDict *migrate_query_not_failed(QTestState *who); |
| 32 | |
| 33 | void wait_for_migration_status(QTestState *who, |
| 34 | const char *goal, const char **ungoals); |
| 35 | |
| 36 | void wait_for_migration_complete(QTestState *who); |
| 37 | |
| 38 | void wait_for_migration_fail(QTestState *from, bool allow_active); |
| 39 | |
| 40 | char *find_common_machine_version(const char *mtype, const char *var1, |
| 41 | const char *var2); |
| 42 | char *resolve_machine_version(const char *alias, const char *var1, |
| 43 | const char *var2); |
| 44 | #ifdef O_DIRECT |
| 45 | bool probe_o_direct_support(const char *tmpfs); |
| 46 | #else |
| 47 | static inline bool probe_o_direct_support(const char *tmpfs) |
| 48 | { |
| 49 | return false; |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | bool ufd_version_check(bool *uffd_feature_thread_id); |
| 54 | bool kvm_dirty_ring_supported(void); |
| 55 | |
| 56 | void migration_test_add(const char *path, |
| 57 | void (*fn)(char *name, MigrateCommon *args)); |
| 58 | void migration_test_add_suffix(const char *path, const char *suffix, |
| 59 | void (*fn)(char *name, MigrateCommon *args)); |
| 60 | char *migrate_get_connect_uri(QTestState *who); |
| 61 | void migrate_set_ports(QTestState *to, QList *channel_list); |
| 62 | void migration_tests_free(void); |
| 63 | #endif /* MIGRATION_UTIL_H */ |