]>
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 | ||
376253ec AL |
17 | #include "qemu-common.h" |
18 | ||
5bb7910a AL |
19 | #define MIG_STATE_ERROR -1 |
20 | #define MIG_STATE_COMPLETED 0 | |
21 | #define MIG_STATE_CANCELLED 1 | |
22 | #define MIG_STATE_ACTIVE 2 | |
23 | ||
24 | typedef struct MigrationState MigrationState; | |
25 | ||
26 | struct MigrationState | |
27 | { | |
28 | /* FIXME: add more accessors to print migration info */ | |
29 | void (*cancel)(MigrationState *s); | |
30 | int (*get_status)(MigrationState *s); | |
31 | void (*release)(MigrationState *s); | |
32 | }; | |
33 | ||
065e2813 AL |
34 | typedef struct FdMigrationState FdMigrationState; |
35 | ||
36 | struct FdMigrationState | |
37 | { | |
38 | MigrationState mig_state; | |
39 | int64_t bandwidth_limit; | |
40 | QEMUFile *file; | |
41 | int fd; | |
731b0364 | 42 | Monitor *mon_resume; |
065e2813 AL |
43 | int state; |
44 | int (*get_error)(struct FdMigrationState*); | |
45 | int (*close)(struct FdMigrationState*); | |
46 | int (*write)(struct FdMigrationState*, const void *, size_t); | |
47 | void *opaque; | |
48 | }; | |
49 | ||
5bb7910a AL |
50 | void qemu_start_incoming_migration(const char *uri); |
51 | ||
376253ec | 52 | void do_migrate(Monitor *mon, int detach, const char *uri); |
5bb7910a | 53 | |
376253ec | 54 | void do_migrate_cancel(Monitor *mon); |
5bb7910a | 55 | |
376253ec | 56 | void do_migrate_set_speed(Monitor *mon, const char *value); |
5bb7910a | 57 | |
a0a3fd60 GC |
58 | uint64_t migrate_max_downtime(void); |
59 | ||
2ea42952 GC |
60 | void do_migrate_set_downtime(Monitor *mon, const char *value); |
61 | ||
376253ec | 62 | void do_info_migrate(Monitor *mon); |
5bb7910a | 63 | |
065e2813 AL |
64 | int exec_start_incoming_migration(const char *host_port); |
65 | ||
66 | MigrationState *exec_start_outgoing_migration(const char *host_port, | |
67 | int64_t bandwidth_limit, | |
68 | int detach); | |
69 | ||
34c9dd8e AL |
70 | int tcp_start_incoming_migration(const char *host_port); |
71 | ||
72 | MigrationState *tcp_start_outgoing_migration(const char *host_port, | |
73 | int64_t bandwidth_limit, | |
74 | int detach); | |
75 | ||
731b0364 AL |
76 | void migrate_fd_monitor_suspend(FdMigrationState *s); |
77 | ||
065e2813 AL |
78 | void migrate_fd_error(FdMigrationState *s); |
79 | ||
80 | void migrate_fd_cleanup(FdMigrationState *s); | |
81 | ||
82 | void migrate_fd_put_notify(void *opaque); | |
83 | ||
84 | ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size); | |
85 | ||
86 | void migrate_fd_connect(FdMigrationState *s); | |
87 | ||
88 | void migrate_fd_put_ready(void *opaque); | |
89 | ||
90 | int migrate_fd_get_status(MigrationState *mig_state); | |
91 | ||
92 | void migrate_fd_cancel(MigrationState *mig_state); | |
93 | ||
94 | void migrate_fd_release(MigrationState *mig_state); | |
95 | ||
96 | void migrate_fd_wait_for_unfreeze(void *opaque); | |
97 | ||
98 | int migrate_fd_close(void *opaque); | |
99 | ||
100 | static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state) | |
101 | { | |
102 | return container_of(mig_state, FdMigrationState, mig_state); | |
103 | } | |
104 | ||
5bb7910a | 105 | #endif |