]>
Commit | Line | Data |
---|---|---|
5bb7910a AL |
1 | /* |
2 | * QEMU live migration | |
3 | * | |
4 | * Copyright IBM, Corp. 2008 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <aliguori@us.ibm.com> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU GPL, version 2. See | |
10 | * the COPYING file in the top-level directory. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef QEMU_MIGRATION_H | |
15 | #define QEMU_MIGRATION_H | |
16 | ||
f96fc8a0 | 17 | #include "qdict.h" |
376253ec | 18 | #include "qemu-common.h" |
99a0db9b | 19 | #include "notify.h" |
fa2756b7 | 20 | #include "error.h" |
7908c78d | 21 | #include "vmstate.h" |
376253ec | 22 | |
6607ae23 IY |
23 | struct MigrationParams { |
24 | bool blk; | |
25 | bool shared; | |
26 | }; | |
27 | ||
22f00a44 | 28 | typedef struct MigrationState MigrationState; |
dc7acc61 | 29 | |
22f00a44 | 30 | struct MigrationState |
065e2813 | 31 | { |
065e2813 AL |
32 | int64_t bandwidth_limit; |
33 | QEMUFile *file; | |
34 | int fd; | |
065e2813 | 35 | int state; |
22f00a44 JQ |
36 | int (*get_error)(MigrationState *s); |
37 | int (*close)(MigrationState *s); | |
38 | int (*write)(MigrationState *s, const void *buff, size_t size); | |
065e2813 | 39 | void *opaque; |
6607ae23 | 40 | MigrationParams params; |
d5f8a570 | 41 | int64_t total_time; |
065e2813 AL |
42 | }; |
43 | ||
511c0231 JQ |
44 | void process_incoming_migration(QEMUFile *f); |
45 | ||
d5c5dacc | 46 | int qemu_start_incoming_migration(const char *uri, Error **errp); |
5bb7910a | 47 | |
a0a3fd60 GC |
48 | uint64_t migrate_max_downtime(void); |
49 | ||
c86a6683 LC |
50 | void do_info_migrate_print(Monitor *mon, const QObject *data); |
51 | ||
52 | void do_info_migrate(Monitor *mon, QObject **ret_data); | |
5bb7910a | 53 | |
065e2813 AL |
54 | int exec_start_incoming_migration(const char *host_port); |
55 | ||
07af4452 | 56 | int exec_start_outgoing_migration(MigrationState *s, const char *host_port); |
065e2813 | 57 | |
d5c5dacc | 58 | int tcp_start_incoming_migration(const char *host_port, Error **errp); |
34c9dd8e | 59 | |
d5c5dacc AK |
60 | int tcp_start_outgoing_migration(MigrationState *s, const char *host_port, |
61 | Error **errp); | |
34c9dd8e | 62 | |
4951f65b CL |
63 | int unix_start_incoming_migration(const char *path); |
64 | ||
07af4452 | 65 | int unix_start_outgoing_migration(MigrationState *s, const char *path); |
4951f65b | 66 | |
5ac1fad3 PB |
67 | int fd_start_incoming_migration(const char *path); |
68 | ||
07af4452 | 69 | int fd_start_outgoing_migration(MigrationState *s, const char *fdname); |
5ac1fad3 | 70 | |
22f00a44 | 71 | void migrate_fd_error(MigrationState *s); |
065e2813 | 72 | |
22f00a44 | 73 | void migrate_fd_connect(MigrationState *s); |
065e2813 | 74 | |
99a0db9b GH |
75 | void add_migration_state_change_notifier(Notifier *notify); |
76 | void remove_migration_state_change_notifier(Notifier *notify); | |
afe2df69 | 77 | bool migration_is_active(MigrationState *); |
7073693b | 78 | bool migration_has_finished(MigrationState *); |
afe2df69 | 79 | bool migration_has_failed(MigrationState *); |
99a0db9b | 80 | |
adc56dda BS |
81 | uint64_t ram_bytes_remaining(void); |
82 | uint64_t ram_bytes_transferred(void); | |
83 | uint64_t ram_bytes_total(void); | |
84 | ||
7908c78d | 85 | extern SaveVMHandlers savevm_ram_handlers; |
adc56dda | 86 | |
fa2756b7 AL |
87 | /** |
88 | * @migrate_add_blocker - prevent migration from proceeding | |
89 | * | |
90 | * @reason - an error to be returned whenever migration is attempted | |
91 | */ | |
92 | void migrate_add_blocker(Error *reason); | |
93 | ||
94 | /** | |
95 | * @migrate_del_blocker - remove a blocking error from migration | |
96 | * | |
97 | * @reason - the error blocking migration | |
98 | */ | |
99 | void migrate_del_blocker(Error *reason); | |
100 | ||
5bb7910a | 101 | #endif |