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"
23 struct MigrationParams
{
28 typedef struct MigrationState MigrationState
;
32 int64_t bandwidth_limit
;
36 int (*get_error
)(MigrationState
*s
);
37 int (*close
)(MigrationState
*s
);
38 int (*write
)(MigrationState
*s
, const void *buff
, size_t size
);
40 MigrationParams params
;
44 void process_incoming_migration(QEMUFile
*f
);
46 int qemu_start_incoming_migration(const char *uri
, Error
**errp
);
48 uint64_t migrate_max_downtime(void);
50 void do_info_migrate_print(Monitor
*mon
, const QObject
*data
);
52 void do_info_migrate(Monitor
*mon
, QObject
**ret_data
);
54 int exec_start_incoming_migration(const char *host_port
);
56 int exec_start_outgoing_migration(MigrationState
*s
, const char *host_port
);
58 int tcp_start_incoming_migration(const char *host_port
, Error
**errp
);
60 int tcp_start_outgoing_migration(MigrationState
*s
, const char *host_port
,
63 int unix_start_incoming_migration(const char *path
);
65 int unix_start_outgoing_migration(MigrationState
*s
, const char *path
);
67 int fd_start_incoming_migration(const char *path
);
69 int fd_start_outgoing_migration(MigrationState
*s
, const char *fdname
);
71 void migrate_fd_error(MigrationState
*s
);
73 void migrate_fd_connect(MigrationState
*s
);
75 void add_migration_state_change_notifier(Notifier
*notify
);
76 void remove_migration_state_change_notifier(Notifier
*notify
);
77 bool migration_is_active(MigrationState
*);
78 bool migration_has_finished(MigrationState
*);
79 bool migration_has_failed(MigrationState
*);
81 uint64_t ram_bytes_remaining(void);
82 uint64_t ram_bytes_transferred(void);
83 uint64_t ram_bytes_total(void);
85 extern SaveVMHandlers savevm_ram_handlers
;
88 * @migrate_add_blocker - prevent migration from proceeding
90 * @reason - an error to be returned whenever migration is attempted
92 void migrate_add_blocker(Error
*reason
);
95 * @migrate_del_blocker - remove a blocking error from migration
97 * @reason - the error blocking migration
99 void migrate_del_blocker(Error
*reason
);