qapi: Convert getfd and closefd
[qemu-kvm.git] / migration.h
blobde130045731bd664524e6d41cab2d7f5f7c10324
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 struct MigrationParams {
23 bool blk;
24 bool shared;
27 typedef struct MigrationState MigrationState;
29 struct MigrationState
31 int64_t bandwidth_limit;
32 QEMUFile *file;
33 int fd;
34 int state;
35 int (*get_error)(MigrationState *s);
36 int (*close)(MigrationState *s);
37 int (*write)(MigrationState *s, const void *buff, size_t size);
38 void *opaque;
39 MigrationParams params;
40 int64_t total_time;
43 void process_incoming_migration(QEMUFile *f);
45 int qemu_start_incoming_migration(const char *uri, Error **errp);
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, Error **errp);
59 int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
60 Error **errp);
62 int unix_start_incoming_migration(const char *path);
64 int unix_start_outgoing_migration(MigrationState *s, const char *path);
66 int fd_start_incoming_migration(const char *path);
68 int fd_start_outgoing_migration(MigrationState *s, const char *fdname);
70 void migrate_fd_error(MigrationState *s);
72 void migrate_fd_connect(MigrationState *s);
74 void add_migration_state_change_notifier(Notifier *notify);
75 void remove_migration_state_change_notifier(Notifier *notify);
76 bool migration_is_active(MigrationState *);
77 bool migration_has_finished(MigrationState *);
78 bool migration_has_failed(MigrationState *);
80 uint64_t ram_bytes_remaining(void);
81 uint64_t ram_bytes_transferred(void);
82 uint64_t ram_bytes_total(void);
84 int ram_save_live(QEMUFile *f, int stage, void *opaque);
85 int ram_load(QEMUFile *f, void *opaque, int version_id);
87 /**
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);
94 /**
95 * @migrate_del_blocker - remove a blocking error from migration
97 * @reason - the error blocking migration
99 void migrate_del_blocker(Error *reason);
101 #endif