monitor: Convert do_info_kvm() to QObject
[qemu/stefanha.git] / migration.h
blob3f2b3df2bd5ac190793b11ed057fef06596ad617
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"
20 #define MIG_STATE_ERROR -1
21 #define MIG_STATE_COMPLETED 0
22 #define MIG_STATE_CANCELLED 1
23 #define MIG_STATE_ACTIVE 2
25 typedef struct MigrationState MigrationState;
27 struct MigrationState
29 /* FIXME: add more accessors to print migration info */
30 void (*cancel)(MigrationState *s);
31 int (*get_status)(MigrationState *s);
32 void (*release)(MigrationState *s);
33 int blk;
34 int shared;
37 typedef struct FdMigrationState FdMigrationState;
39 struct FdMigrationState
41 MigrationState mig_state;
42 int64_t bandwidth_limit;
43 QEMUFile *file;
44 int fd;
45 Monitor *mon;
46 int state;
47 int (*get_error)(struct FdMigrationState*);
48 int (*close)(struct FdMigrationState*);
49 int (*write)(struct FdMigrationState*, const void *, size_t);
50 void *opaque;
53 void qemu_start_incoming_migration(const char *uri);
55 void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
57 void do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data);
59 void do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data);
61 uint64_t migrate_max_downtime(void);
63 void do_migrate_set_downtime(Monitor *mon, const QDict *qdict);
65 void do_info_migrate(Monitor *mon);
67 int exec_start_incoming_migration(const char *host_port);
69 MigrationState *exec_start_outgoing_migration(Monitor *mon,
70 const char *host_port,
71 int64_t bandwidth_limit,
72 int detach,
73 int blk,
74 int inc);
76 int tcp_start_incoming_migration(const char *host_port);
78 MigrationState *tcp_start_outgoing_migration(Monitor *mon,
79 const char *host_port,
80 int64_t bandwidth_limit,
81 int detach,
82 int blk,
83 int inc);
85 int unix_start_incoming_migration(const char *path);
87 MigrationState *unix_start_outgoing_migration(Monitor *mon,
88 const char *path,
89 int64_t bandwidth_limit,
90 int detach,
91 int blk,
92 int inc);
94 int fd_start_incoming_migration(const char *path);
96 MigrationState *fd_start_outgoing_migration(Monitor *mon,
97 const char *fdname,
98 int64_t bandwidth_limit,
99 int detach,
100 int blk,
101 int inc);
103 void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon);
105 void migrate_fd_error(FdMigrationState *s);
107 void migrate_fd_cleanup(FdMigrationState *s);
109 void migrate_fd_put_notify(void *opaque);
111 ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size);
113 void migrate_fd_connect(FdMigrationState *s);
115 void migrate_fd_put_ready(void *opaque);
117 int migrate_fd_get_status(MigrationState *mig_state);
119 void migrate_fd_cancel(MigrationState *mig_state);
121 void migrate_fd_release(MigrationState *mig_state);
123 void migrate_fd_wait_for_unfreeze(void *opaque);
125 int migrate_fd_close(void *opaque);
127 static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state)
129 return container_of(mig_state, FdMigrationState, mig_state);
132 #endif