qapi: Convert migrate_set_downtime
[qemu/wangdongxu.git] / migration.h
blob539f8f184029b4899d154e8e8c24888c80f4d579
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"
22 typedef struct MigrationState MigrationState;
24 struct MigrationState
26 int64_t bandwidth_limit;
27 QEMUFile *file;
28 int fd;
29 Monitor *mon;
30 int state;
31 int (*get_error)(MigrationState *s);
32 int (*close)(MigrationState *s);
33 int (*write)(MigrationState *s, const void *buff, size_t size);
34 void *opaque;
35 int blk;
36 int shared;
39 void process_incoming_migration(QEMUFile *f);
41 int qemu_start_incoming_migration(const char *uri);
43 int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
45 int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data);
47 uint64_t migrate_max_downtime(void);
49 void do_info_migrate_print(Monitor *mon, const QObject *data);
51 void do_info_migrate(Monitor *mon, QObject **ret_data);
53 int exec_start_incoming_migration(const char *host_port);
55 int exec_start_outgoing_migration(MigrationState *s, const char *host_port);
57 int tcp_start_incoming_migration(const char *host_port);
59 int tcp_start_outgoing_migration(MigrationState *s, const char *host_port);
61 int unix_start_incoming_migration(const char *path);
63 int unix_start_outgoing_migration(MigrationState *s, const char *path);
65 int fd_start_incoming_migration(const char *path);
67 int fd_start_outgoing_migration(MigrationState *s, const char *fdname);
69 void migrate_fd_error(MigrationState *s);
71 void migrate_fd_connect(MigrationState *s);
73 void add_migration_state_change_notifier(Notifier *notify);
74 void remove_migration_state_change_notifier(Notifier *notify);
75 bool migration_is_active(MigrationState *);
76 bool migration_has_finished(MigrationState *);
77 bool migration_has_failed(MigrationState *);
79 uint64_t ram_bytes_remaining(void);
80 uint64_t ram_bytes_transferred(void);
81 uint64_t ram_bytes_total(void);
83 int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque);
84 int ram_load(QEMUFile *f, void *opaque, int version_id);
86 extern int incoming_expected;
88 /**
89 * @migrate_add_blocker - prevent migration from proceeding
91 * @reason - an error to be returned whenever migration is attempted
93 void migrate_add_blocker(Error *reason);
95 /**
96 * @migrate_del_blocker - remove a blocking error from migration
98 * @reason - the error blocking migration
100 void migrate_del_blocker(Error *reason);
102 #endif