Merge remote-tracking branch 'kwolf/for-anthony' into staging
[qemu/opensuse.git] / migration.h
bloba9852fcae062b239d0662a6d65bcdaa7ebe208ab
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 "qdict.h"
18 #include "qemu-common.h"
19 #include "notify.h"
20 #include "error.h"
21 #include "vmstate.h"
22 #include "qapi-types.h"
24 struct MigrationParams {
25 bool blk;
26 bool shared;
29 typedef struct MigrationState MigrationState;
31 struct MigrationState
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 bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
44 int64_t xbzrle_cache_size;
47 void process_incoming_migration(QEMUFile *f);
49 int qemu_start_incoming_migration(const char *uri, Error **errp);
51 uint64_t migrate_max_downtime(void);
53 void do_info_migrate_print(Monitor *mon, const QObject *data);
55 void do_info_migrate(Monitor *mon, QObject **ret_data);
57 int exec_start_incoming_migration(const char *host_port);
59 int exec_start_outgoing_migration(MigrationState *s, const char *host_port);
61 int tcp_start_incoming_migration(const char *host_port, Error **errp);
63 int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
64 Error **errp);
66 int unix_start_incoming_migration(const char *path);
68 int unix_start_outgoing_migration(MigrationState *s, const char *path);
70 int fd_start_incoming_migration(const char *path);
72 int fd_start_outgoing_migration(MigrationState *s, const char *fdname);
74 void migrate_fd_error(MigrationState *s);
76 void migrate_fd_connect(MigrationState *s);
78 void add_migration_state_change_notifier(Notifier *notify);
79 void remove_migration_state_change_notifier(Notifier *notify);
80 bool migration_is_active(MigrationState *);
81 bool migration_has_finished(MigrationState *);
82 bool migration_has_failed(MigrationState *);
84 uint64_t ram_bytes_remaining(void);
85 uint64_t ram_bytes_transferred(void);
86 uint64_t ram_bytes_total(void);
88 extern SaveVMHandlers savevm_ram_handlers;
90 uint64_t dup_mig_bytes_transferred(void);
91 uint64_t dup_mig_pages_transferred(void);
92 uint64_t norm_mig_bytes_transferred(void);
93 uint64_t norm_mig_pages_transferred(void);
94 uint64_t xbzrle_mig_bytes_transferred(void);
95 uint64_t xbzrle_mig_pages_transferred(void);
96 uint64_t xbzrle_mig_pages_overflow(void);
97 uint64_t xbzrle_mig_pages_cache_miss(void);
99 /**
100 * @migrate_add_blocker - prevent migration from proceeding
102 * @reason - an error to be returned whenever migration is attempted
104 void migrate_add_blocker(Error *reason);
107 * @migrate_del_blocker - remove a blocking error from migration
109 * @reason - the error blocking migration
111 void migrate_del_blocker(Error *reason);
113 int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
114 uint8_t *dst, int dlen);
115 int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
117 int migrate_use_xbzrle(void);
118 int64_t migrate_xbzrle_cache_size(void);
120 int64_t xbzrle_cache_resize(int64_t new_size);
122 #endif