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
17 #include "qemu-common.h"
19 #define MIG_STATE_ERROR -1
20 #define MIG_STATE_COMPLETED 0
21 #define MIG_STATE_CANCELLED 1
22 #define MIG_STATE_ACTIVE 2
24 typedef struct MigrationState MigrationState
;
28 /* FIXME: add more accessors to print migration info */
29 void (*cancel
)(MigrationState
*s
);
30 int (*get_status
)(MigrationState
*s
);
31 void (*release
)(MigrationState
*s
);
34 typedef struct FdMigrationState FdMigrationState
;
36 struct FdMigrationState
38 MigrationState mig_state
;
39 int64_t bandwidth_limit
;
44 int (*get_error
)(struct FdMigrationState
*);
45 int (*close
)(struct FdMigrationState
*);
46 int (*write
)(struct FdMigrationState
*, const void *, size_t);
50 void qemu_start_incoming_migration(const char *uri
);
52 void do_migrate(Monitor
*mon
, int detach
, const char *uri
);
54 void do_migrate_cancel(Monitor
*mon
);
56 void do_migrate_set_speed(Monitor
*mon
, const char *value
);
58 uint64_t migrate_max_downtime(void);
60 void do_migrate_set_downtime(Monitor
*mon
, const char *value
);
62 void do_info_migrate(Monitor
*mon
);
64 int exec_start_incoming_migration(const char *host_port
);
66 MigrationState
*exec_start_outgoing_migration(const char *host_port
,
67 int64_t bandwidth_limit
,
70 int tcp_start_incoming_migration(const char *host_port
);
72 MigrationState
*tcp_start_outgoing_migration(const char *host_port
,
73 int64_t bandwidth_limit
,
76 int unix_start_incoming_migration(const char *path
);
78 MigrationState
*unix_start_outgoing_migration(const char *path
,
79 int64_t bandwidth_limit
,
82 int fd_start_incoming_migration(const char *path
);
84 MigrationState
*fd_start_outgoing_migration(Monitor
*mon
,
86 int64_t bandwidth_limit
,
89 void migrate_fd_monitor_suspend(FdMigrationState
*s
);
91 void migrate_fd_error(FdMigrationState
*s
);
93 void migrate_fd_cleanup(FdMigrationState
*s
);
95 void migrate_fd_put_notify(void *opaque
);
97 ssize_t
migrate_fd_put_buffer(void *opaque
, const void *data
, size_t size
);
99 void migrate_fd_connect(FdMigrationState
*s
);
101 void migrate_fd_put_ready(void *opaque
);
103 int migrate_fd_get_status(MigrationState
*mig_state
);
105 void migrate_fd_cancel(MigrationState
*mig_state
);
107 void migrate_fd_release(MigrationState
*mig_state
);
109 void migrate_fd_wait_for_unfreeze(void *opaque
);
111 int migrate_fd_close(void *opaque
);
113 static inline FdMigrationState
*migrate_to_fms(MigrationState
*mig_state
)
115 return container_of(mig_state
, FdMigrationState
, mig_state
);