root / include / migration / migration.h @ 1de7afc9
History | View | Annotate | Download (3.7 kB)
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 |
|
17 |
#include "qapi/qmp/qdict.h" |
18 |
#include "qemu-common.h" |
19 |
#include "qemu/notify.h" |
20 |
#include "qapi/error.h" |
21 |
#include "migration/vmstate.h" |
22 |
#include "qapi-types.h" |
23 |
|
24 |
struct MigrationParams {
|
25 |
bool blk;
|
26 |
bool shared;
|
27 |
}; |
28 |
|
29 |
typedef struct MigrationState MigrationState; |
30 |
|
31 |
struct MigrationState
|
32 |
{ |
33 |
int64_t bandwidth_limit; |
34 |
QEMUFile *file; |
35 |
int fd;
|
36 |
int state;
|
37 |
int (*get_error)(MigrationState *s);
|
38 |
int (*close)(MigrationState *s);
|
39 |
int (*write)(MigrationState *s, const void *buff, size_t size); |
40 |
void *opaque;
|
41 |
MigrationParams params; |
42 |
int64_t total_time; |
43 |
int64_t downtime; |
44 |
int64_t expected_downtime; |
45 |
int64_t dirty_pages_rate; |
46 |
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
|
47 |
int64_t xbzrle_cache_size; |
48 |
}; |
49 |
|
50 |
void process_incoming_migration(QEMUFile *f);
|
51 |
|
52 |
void qemu_start_incoming_migration(const char *uri, Error **errp); |
53 |
|
54 |
uint64_t migrate_max_downtime(void);
|
55 |
|
56 |
void do_info_migrate_print(Monitor *mon, const QObject *data); |
57 |
|
58 |
void do_info_migrate(Monitor *mon, QObject **ret_data);
|
59 |
|
60 |
void exec_start_incoming_migration(const char *host_port, Error **errp); |
61 |
|
62 |
void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp); |
63 |
|
64 |
void tcp_start_incoming_migration(const char *host_port, Error **errp); |
65 |
|
66 |
void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp); |
67 |
|
68 |
void unix_start_incoming_migration(const char *path, Error **errp); |
69 |
|
70 |
void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp); |
71 |
|
72 |
void fd_start_incoming_migration(const char *path, Error **errp); |
73 |
|
74 |
void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp); |
75 |
|
76 |
void migrate_fd_error(MigrationState *s);
|
77 |
|
78 |
void migrate_fd_connect(MigrationState *s);
|
79 |
|
80 |
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data, |
81 |
size_t size); |
82 |
void migrate_fd_put_ready(MigrationState *s);
|
83 |
int migrate_fd_wait_for_unfreeze(MigrationState *s);
|
84 |
int migrate_fd_close(MigrationState *s);
|
85 |
|
86 |
void add_migration_state_change_notifier(Notifier *notify);
|
87 |
void remove_migration_state_change_notifier(Notifier *notify);
|
88 |
bool migration_is_active(MigrationState *);
|
89 |
bool migration_has_finished(MigrationState *);
|
90 |
bool migration_has_failed(MigrationState *);
|
91 |
MigrationState *migrate_get_current(void);
|
92 |
|
93 |
uint64_t ram_bytes_remaining(void);
|
94 |
uint64_t ram_bytes_transferred(void);
|
95 |
uint64_t ram_bytes_total(void);
|
96 |
|
97 |
extern SaveVMHandlers savevm_ram_handlers;
|
98 |
|
99 |
uint64_t dup_mig_bytes_transferred(void);
|
100 |
uint64_t dup_mig_pages_transferred(void);
|
101 |
uint64_t norm_mig_bytes_transferred(void);
|
102 |
uint64_t norm_mig_pages_transferred(void);
|
103 |
uint64_t xbzrle_mig_bytes_transferred(void);
|
104 |
uint64_t xbzrle_mig_pages_transferred(void);
|
105 |
uint64_t xbzrle_mig_pages_overflow(void);
|
106 |
uint64_t xbzrle_mig_pages_cache_miss(void);
|
107 |
|
108 |
/**
|
109 |
* @migrate_add_blocker - prevent migration from proceeding
|
110 |
*
|
111 |
* @reason - an error to be returned whenever migration is attempted
|
112 |
*/
|
113 |
void migrate_add_blocker(Error *reason);
|
114 |
|
115 |
/**
|
116 |
* @migrate_del_blocker - remove a blocking error from migration
|
117 |
*
|
118 |
* @reason - the error blocking migration
|
119 |
*/
|
120 |
void migrate_del_blocker(Error *reason);
|
121 |
|
122 |
int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, |
123 |
uint8_t *dst, int dlen);
|
124 |
int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen); |
125 |
|
126 |
int migrate_use_xbzrle(void); |
127 |
int64_t migrate_xbzrle_cache_size(void);
|
128 |
|
129 |
int64_t xbzrle_cache_resize(int64_t new_size); |
130 |
|
131 |
#endif
|