Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
[qemu.git] / migration.h
blob1b8ee58530e354cebeef5b667bb24e3ca0447c86
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"
21 typedef struct MigrationState MigrationState;
23 struct MigrationState
25 int64_t bandwidth_limit;
26 QEMUFile *file;
27 int fd;
28 Monitor *mon;
29 int state;
30 int (*get_error)(MigrationState *s);
31 int (*close)(MigrationState *s);
32 int (*write)(MigrationState *s, const void *buff, size_t size);
33 void *opaque;
34 int blk;
35 int shared;
38 void process_incoming_migration(QEMUFile *f);
40 int qemu_start_incoming_migration(const char *uri);
42 int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
44 int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data);
46 int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data);
48 uint64_t migrate_max_downtime(void);
50 int do_migrate_set_downtime(Monitor *mon, const QDict *qdict,
51 QObject **ret_data);
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);
63 int tcp_start_outgoing_migration(MigrationState *s, const char *host_port);
65 int unix_start_incoming_migration(const char *path);
67 int unix_start_outgoing_migration(MigrationState *s, const char *path);
69 int fd_start_incoming_migration(const char *path);
71 int fd_start_outgoing_migration(MigrationState *s, const char *fdname);
73 void migrate_fd_error(MigrationState *s);
75 void migrate_fd_connect(MigrationState *s);
77 void add_migration_state_change_notifier(Notifier *notify);
78 void remove_migration_state_change_notifier(Notifier *notify);
79 bool migration_is_active(MigrationState *);
80 bool migration_has_finished(MigrationState *);
81 bool migration_has_failed(MigrationState *);
83 uint64_t ram_bytes_remaining(void);
84 uint64_t ram_bytes_transferred(void);
85 uint64_t ram_bytes_total(void);
87 int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque);
88 int ram_load(QEMUFile *f, void *opaque, int version_id);
90 extern int incoming_expected;
92 #endif