]>
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 AL |
18 | #include "qemu-common.h" |
19 | ||
5bb7910a AL |
20 | #define MIG_STATE_ERROR -1 |
21 | #define MIG_STATE_COMPLETED 0 | |
22 | #define MIG_STATE_CANCELLED 1 | |
23 | #define MIG_STATE_ACTIVE 2 | |
24 | ||
25 | typedef struct MigrationState MigrationState; | |
26 | ||
27 | struct MigrationState | |
28 | { | |
29 | /* FIXME: add more accessors to print migration info */ | |
30 | void (*cancel)(MigrationState *s); | |
31 | int (*get_status)(MigrationState *s); | |
32 | void (*release)(MigrationState *s); | |
c163b5ca LS |
33 | int blk; |
34 | int shared; | |
5bb7910a AL |
35 | }; |
36 | ||
065e2813 AL |
37 | typedef struct FdMigrationState FdMigrationState; |
38 | ||
39 | struct FdMigrationState | |
40 | { | |
41 | MigrationState mig_state; | |
42 | int64_t bandwidth_limit; | |
43 | QEMUFile *file; | |
44 | int fd; | |
f327aa0c | 45 | Monitor *mon; |
065e2813 AL |
46 | int state; |
47 | int (*get_error)(struct FdMigrationState*); | |
48 | int (*close)(struct FdMigrationState*); | |
49 | int (*write)(struct FdMigrationState*, const void *, size_t); | |
50 | void *opaque; | |
51 | }; | |
52 | ||
511c0231 JQ |
53 | void process_incoming_migration(QEMUFile *f); |
54 | ||
8ca5e801 | 55 | int qemu_start_incoming_migration(const char *uri); |
5bb7910a | 56 | |
b5d17adb | 57 | int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 58 | |
ef4b7eee | 59 | int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 60 | |
ef4b7eee | 61 | int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 62 | |
a0a3fd60 GC |
63 | uint64_t migrate_max_downtime(void); |
64 | ||
ef4b7eee LC |
65 | int do_migrate_set_downtime(Monitor *mon, const QDict *qdict, |
66 | QObject **ret_data); | |
2ea42952 | 67 | |
c86a6683 LC |
68 | void do_info_migrate_print(Monitor *mon, const QObject *data); |
69 | ||
70 | void do_info_migrate(Monitor *mon, QObject **ret_data); | |
5bb7910a | 71 | |
065e2813 AL |
72 | int exec_start_incoming_migration(const char *host_port); |
73 | ||
f327aa0c JK |
74 | MigrationState *exec_start_outgoing_migration(Monitor *mon, |
75 | const char *host_port, | |
c163b5ca LS |
76 | int64_t bandwidth_limit, |
77 | int detach, | |
78 | int blk, | |
79 | int inc); | |
065e2813 | 80 | |
34c9dd8e AL |
81 | int tcp_start_incoming_migration(const char *host_port); |
82 | ||
f327aa0c JK |
83 | MigrationState *tcp_start_outgoing_migration(Monitor *mon, |
84 | const char *host_port, | |
34c9dd8e | 85 | int64_t bandwidth_limit, |
c163b5ca LS |
86 | int detach, |
87 | int blk, | |
88 | int inc); | |
34c9dd8e | 89 | |
4951f65b CL |
90 | int unix_start_incoming_migration(const char *path); |
91 | ||
f327aa0c JK |
92 | MigrationState *unix_start_outgoing_migration(Monitor *mon, |
93 | const char *path, | |
4951f65b | 94 | int64_t bandwidth_limit, |
c163b5ca LS |
95 | int detach, |
96 | int blk, | |
97 | int inc); | |
4951f65b | 98 | |
5ac1fad3 PB |
99 | int fd_start_incoming_migration(const char *path); |
100 | ||
101 | MigrationState *fd_start_outgoing_migration(Monitor *mon, | |
102 | const char *fdname, | |
103 | int64_t bandwidth_limit, | |
c163b5ca LS |
104 | int detach, |
105 | int blk, | |
106 | int inc); | |
5ac1fad3 | 107 | |
f327aa0c | 108 | void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon); |
731b0364 | 109 | |
065e2813 AL |
110 | void migrate_fd_error(FdMigrationState *s); |
111 | ||
41ef56e6 | 112 | int migrate_fd_cleanup(FdMigrationState *s); |
065e2813 AL |
113 | |
114 | void migrate_fd_put_notify(void *opaque); | |
115 | ||
116 | ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size); | |
117 | ||
118 | void migrate_fd_connect(FdMigrationState *s); | |
119 | ||
120 | void migrate_fd_put_ready(void *opaque); | |
121 | ||
122 | int migrate_fd_get_status(MigrationState *mig_state); | |
123 | ||
124 | void migrate_fd_cancel(MigrationState *mig_state); | |
125 | ||
126 | void migrate_fd_release(MigrationState *mig_state); | |
127 | ||
128 | void migrate_fd_wait_for_unfreeze(void *opaque); | |
129 | ||
130 | int migrate_fd_close(void *opaque); | |
131 | ||
132 | static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state) | |
133 | { | |
134 | return container_of(mig_state, FdMigrationState, mig_state); | |
135 | } | |
136 | ||
5bb7910a | 137 | #endif |