]>
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; | |
731b0364 | 45 | Monitor *mon_resume; |
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 | ||
5bb7910a AL |
53 | void qemu_start_incoming_migration(const char *uri); |
54 | ||
5f79da00 | 55 | void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 56 | |
911d2963 | 57 | void do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 58 | |
3a492104 | 59 | void do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data); |
5bb7910a | 60 | |
a0a3fd60 GC |
61 | uint64_t migrate_max_downtime(void); |
62 | ||
d54908a5 | 63 | void do_migrate_set_downtime(Monitor *mon, const QDict *qdict); |
2ea42952 | 64 | |
376253ec | 65 | void do_info_migrate(Monitor *mon); |
5bb7910a | 66 | |
065e2813 AL |
67 | int exec_start_incoming_migration(const char *host_port); |
68 | ||
69 | MigrationState *exec_start_outgoing_migration(const char *host_port, | |
c163b5ca LS |
70 | int64_t bandwidth_limit, |
71 | int detach, | |
72 | int blk, | |
73 | int inc); | |
065e2813 | 74 | |
34c9dd8e AL |
75 | int tcp_start_incoming_migration(const char *host_port); |
76 | ||
77 | MigrationState *tcp_start_outgoing_migration(const char *host_port, | |
78 | int64_t bandwidth_limit, | |
c163b5ca LS |
79 | int detach, |
80 | int blk, | |
81 | int inc); | |
34c9dd8e | 82 | |
4951f65b CL |
83 | int unix_start_incoming_migration(const char *path); |
84 | ||
85 | MigrationState *unix_start_outgoing_migration(const char *path, | |
86 | int64_t bandwidth_limit, | |
c163b5ca LS |
87 | int detach, |
88 | int blk, | |
89 | int inc); | |
4951f65b | 90 | |
5ac1fad3 PB |
91 | int fd_start_incoming_migration(const char *path); |
92 | ||
93 | MigrationState *fd_start_outgoing_migration(Monitor *mon, | |
94 | const char *fdname, | |
95 | int64_t bandwidth_limit, | |
c163b5ca LS |
96 | int detach, |
97 | int blk, | |
98 | int inc); | |
5ac1fad3 | 99 | |
731b0364 AL |
100 | void migrate_fd_monitor_suspend(FdMigrationState *s); |
101 | ||
065e2813 AL |
102 | void migrate_fd_error(FdMigrationState *s); |
103 | ||
104 | void migrate_fd_cleanup(FdMigrationState *s); | |
105 | ||
106 | void migrate_fd_put_notify(void *opaque); | |
107 | ||
108 | ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size); | |
109 | ||
110 | void migrate_fd_connect(FdMigrationState *s); | |
111 | ||
112 | void migrate_fd_put_ready(void *opaque); | |
113 | ||
114 | int migrate_fd_get_status(MigrationState *mig_state); | |
115 | ||
116 | void migrate_fd_cancel(MigrationState *mig_state); | |
117 | ||
118 | void migrate_fd_release(MigrationState *mig_state); | |
119 | ||
120 | void migrate_fd_wait_for_unfreeze(void *opaque); | |
121 | ||
122 | int migrate_fd_close(void *opaque); | |
123 | ||
124 | static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state) | |
125 | { | |
126 | return container_of(mig_state, FdMigrationState, mig_state); | |
127 | } | |
128 | ||
5bb7910a | 129 | #endif |