qemu-log: Rename CPULogItem, cpu_log_items to QEMULogItem, qemu_log_items
[qemu/pbrook.git] / include / migration / migration.h
bloba8c963973200ec378b6ea8d95b8344ee458a9b7d
1 /*
2 * QEMU live migration
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef QEMU_MIGRATION_H
15 #define QEMU_MIGRATION_H
17 #include "qapi/qmp/qdict.h"
18 #include "qemu-common.h"
19 #include "qemu/thread.h"
20 #include "qemu/notify.h"
21 #include "qapi/error.h"
22 #include "migration/vmstate.h"
23 #include "qapi-types.h"
25 struct MigrationParams {
26 bool blk;
27 bool shared;
30 typedef struct MigrationState MigrationState;
32 struct MigrationState
34 int64_t bandwidth_limit;
35 size_t bytes_xfer;
36 size_t xfer_limit;
37 uint8_t *buffer;
38 size_t buffer_size;
39 size_t buffer_capacity;
40 QemuThread thread;
42 QEMUFile *file;
43 int fd;
44 int state;
45 int (*get_error)(MigrationState *s);
46 int (*close)(MigrationState *s);
47 int (*write)(MigrationState *s, const void *buff, size_t size);
48 void *opaque;
49 MigrationParams params;
50 int64_t total_time;
51 int64_t downtime;
52 int64_t expected_downtime;
53 int64_t dirty_pages_rate;
54 bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
55 int64_t xbzrle_cache_size;
56 bool complete;
59 void process_incoming_migration(QEMUFile *f);
61 void qemu_start_incoming_migration(const char *uri, Error **errp);
63 uint64_t migrate_max_downtime(void);
65 void do_info_migrate_print(Monitor *mon, const QObject *data);
67 void do_info_migrate(Monitor *mon, QObject **ret_data);
69 void exec_start_incoming_migration(const char *host_port, Error **errp);
71 void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
73 void tcp_start_incoming_migration(const char *host_port, Error **errp);
75 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
77 void unix_start_incoming_migration(const char *path, Error **errp);
79 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
81 void fd_start_incoming_migration(const char *path, Error **errp);
83 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
85 void migrate_fd_error(MigrationState *s);
87 void migrate_fd_connect(MigrationState *s);
89 int migrate_fd_close(MigrationState *s);
91 void add_migration_state_change_notifier(Notifier *notify);
92 void remove_migration_state_change_notifier(Notifier *notify);
93 bool migration_is_active(MigrationState *);
94 bool migration_has_finished(MigrationState *);
95 bool migration_has_failed(MigrationState *);
96 MigrationState *migrate_get_current(void);
98 uint64_t ram_bytes_remaining(void);
99 uint64_t ram_bytes_transferred(void);
100 uint64_t ram_bytes_total(void);
102 extern SaveVMHandlers savevm_ram_handlers;
104 uint64_t dup_mig_bytes_transferred(void);
105 uint64_t dup_mig_pages_transferred(void);
106 uint64_t norm_mig_bytes_transferred(void);
107 uint64_t norm_mig_pages_transferred(void);
108 uint64_t xbzrle_mig_bytes_transferred(void);
109 uint64_t xbzrle_mig_pages_transferred(void);
110 uint64_t xbzrle_mig_pages_overflow(void);
111 uint64_t xbzrle_mig_pages_cache_miss(void);
114 * @migrate_add_blocker - prevent migration from proceeding
116 * @reason - an error to be returned whenever migration is attempted
118 void migrate_add_blocker(Error *reason);
121 * @migrate_del_blocker - remove a blocking error from migration
123 * @reason - the error blocking migration
125 void migrate_del_blocker(Error *reason);
127 int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
128 uint8_t *dst, int dlen);
129 int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
131 int migrate_use_xbzrle(void);
132 int64_t migrate_xbzrle_cache_size(void);
134 int64_t xbzrle_cache_resize(int64_t new_size);
135 #endif