]>
Commit | Line | Data |
---|---|---|
5bb7910a AL |
1 | /* |
2 | * QEMU live migration | |
3 | * | |
4 | * Copyright IBM, Corp. 2008 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <[email protected]> | |
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" |
bbf6da32 | 22 | #include "qapi-types.h" |
376253ec | 23 | |
6607ae23 IY |
24 | struct MigrationParams { |
25 | bool blk; | |
26 | bool shared; | |
27 | }; | |
28 | ||
22f00a44 | 29 | typedef struct MigrationState MigrationState; |
dc7acc61 | 30 | |
22f00a44 | 31 | struct MigrationState |
065e2813 | 32 | { |
065e2813 AL |
33 | int64_t bandwidth_limit; |
34 | QEMUFile *file; | |
35 | int fd; | |
065e2813 | 36 | int state; |
22f00a44 JQ |
37 | int (*get_error)(MigrationState *s); |
38 | int (*close)(MigrationState *s); | |
39 | int (*write)(MigrationState *s, const void *buff, size_t size); | |
065e2813 | 40 | void *opaque; |
6607ae23 | 41 | MigrationParams params; |
d5f8a570 | 42 | int64_t total_time; |
bbf6da32 | 43 | bool enabled_capabilities[MIGRATION_CAPABILITY_MAX]; |
17ad9b35 | 44 | int64_t xbzrle_cache_size; |
065e2813 AL |
45 | }; |
46 | ||
511c0231 JQ |
47 | void process_incoming_migration(QEMUFile *f); |
48 | ||
d5c5dacc | 49 | int qemu_start_incoming_migration(const char *uri, Error **errp); |
5bb7910a | 50 | |
a0a3fd60 GC |
51 | uint64_t migrate_max_downtime(void); |
52 | ||
c86a6683 LC |
53 | void do_info_migrate_print(Monitor *mon, const QObject *data); |
54 | ||
55 | void do_info_migrate(Monitor *mon, QObject **ret_data); | |
5bb7910a | 56 | |
065e2813 AL |
57 | int exec_start_incoming_migration(const char *host_port); |
58 | ||
07af4452 | 59 | int exec_start_outgoing_migration(MigrationState *s, const char *host_port); |
065e2813 | 60 | |
d5c5dacc | 61 | int tcp_start_incoming_migration(const char *host_port, Error **errp); |
34c9dd8e | 62 | |
d5c5dacc AK |
63 | int tcp_start_outgoing_migration(MigrationState *s, const char *host_port, |
64 | Error **errp); | |
34c9dd8e | 65 | |
4951f65b CL |
66 | int unix_start_incoming_migration(const char *path); |
67 | ||
07af4452 | 68 | int unix_start_outgoing_migration(MigrationState *s, const char *path); |
4951f65b | 69 | |
5ac1fad3 PB |
70 | int fd_start_incoming_migration(const char *path); |
71 | ||
07af4452 | 72 | int fd_start_outgoing_migration(MigrationState *s, const char *fdname); |
5ac1fad3 | 73 | |
22f00a44 | 74 | void migrate_fd_error(MigrationState *s); |
065e2813 | 75 | |
22f00a44 | 76 | void migrate_fd_connect(MigrationState *s); |
065e2813 | 77 | |
99a0db9b GH |
78 | void add_migration_state_change_notifier(Notifier *notify); |
79 | void remove_migration_state_change_notifier(Notifier *notify); | |
afe2df69 | 80 | bool migration_is_active(MigrationState *); |
7073693b | 81 | bool migration_has_finished(MigrationState *); |
afe2df69 | 82 | bool migration_has_failed(MigrationState *); |
99a0db9b | 83 | |
adc56dda BS |
84 | uint64_t ram_bytes_remaining(void); |
85 | uint64_t ram_bytes_transferred(void); | |
86 | uint64_t ram_bytes_total(void); | |
87 | ||
7908c78d | 88 | extern SaveVMHandlers savevm_ram_handlers; |
adc56dda | 89 | |
004d4c10 OW |
90 | uint64_t dup_mig_bytes_transferred(void); |
91 | uint64_t dup_mig_pages_transferred(void); | |
92 | uint64_t norm_mig_bytes_transferred(void); | |
93 | uint64_t norm_mig_pages_transferred(void); | |
f36d55af OW |
94 | uint64_t xbzrle_mig_bytes_transferred(void); |
95 | uint64_t xbzrle_mig_pages_transferred(void); | |
96 | uint64_t xbzrle_mig_pages_overflow(void); | |
97 | uint64_t xbzrle_mig_pages_cache_miss(void); | |
004d4c10 | 98 | |
fa2756b7 AL |
99 | /** |
100 | * @migrate_add_blocker - prevent migration from proceeding | |
101 | * | |
102 | * @reason - an error to be returned whenever migration is attempted | |
103 | */ | |
104 | void migrate_add_blocker(Error *reason); | |
105 | ||
106 | /** | |
107 | * @migrate_del_blocker - remove a blocking error from migration | |
108 | * | |
109 | * @reason - the error blocking migration | |
110 | */ | |
111 | void migrate_del_blocker(Error *reason); | |
112 | ||
302dfbeb OW |
113 | int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, |
114 | uint8_t *dst, int dlen); | |
115 | int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen); | |
116 | ||
17ad9b35 OW |
117 | int migrate_use_xbzrle(void); |
118 | int64_t migrate_xbzrle_cache_size(void); | |
119 | ||
9e1ba4cc OW |
120 | int64_t xbzrle_cache_resize(int64_t new_size); |
121 | ||
5bb7910a | 122 | #endif |