4 * Copyright IBM, Corp. 2008
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
18 #include "qemu-common.h"
22 typedef struct MigrationState MigrationState
;
26 int64_t bandwidth_limit
;
31 int (*get_error
)(MigrationState
*s
);
32 int (*close
)(MigrationState
*s
);
33 int (*write
)(MigrationState
*s
, const void *buff
, size_t size
);
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_cancel(Monitor
*mon
, const QDict
*qdict
, QObject
**ret_data
);
47 int do_migrate_set_speed(Monitor
*mon
, const QDict
*qdict
, QObject
**ret_data
);
49 uint64_t migrate_max_downtime(void);
51 int do_migrate_set_downtime(Monitor
*mon
, const QDict
*qdict
,
54 void do_info_migrate_print(Monitor
*mon
, const QObject
*data
);
56 void do_info_migrate(Monitor
*mon
, QObject
**ret_data
);
58 int exec_start_incoming_migration(const char *host_port
);
60 int exec_start_outgoing_migration(MigrationState
*s
, const char *host_port
);
62 int tcp_start_incoming_migration(const char *host_port
);
64 int tcp_start_outgoing_migration(MigrationState
*s
, const char *host_port
);
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 int ram_save_live(Monitor
*mon
, QEMUFile
*f
, int stage
, void *opaque
);
89 int ram_load(QEMUFile
*f
, void *opaque
, int version_id
);
91 extern int incoming_expected
;
94 * @migrate_add_blocker - prevent migration from proceeding
96 * @reason - an error to be returned whenever migration is attempted
98 void migrate_add_blocker(Error
*reason
);
101 * @migrate_del_blocker - remove a blocking error from migration
103 * @reason - the error blocking migration
105 void migrate_del_blocker(Error
*reason
);