qemu/migration.h
<<
>>
Prefs
   1/*
   2 * QEMU live migration
   3 *
   4 * Copyright IBM, Corp. 2008
   5 *
   6 * Authors:
   7 *  Anthony Liguori   <aliguori@us.ibm.com>
   8 *
   9 * This work is licensed under the terms of the GNU GPL, version 2.  See
  10 * the COPYING file in the top-level directory.
  11 *
  12 */
  13
  14#ifndef QEMU_MIGRATION_H
  15#define QEMU_MIGRATION_H
  16
  17#include "qdict.h"
  18#include "qemu-common.h"
  19#include "notify.h"
  20#include "error.h"
  21
  22typedef struct MigrationState MigrationState;
  23
  24struct MigrationState
  25{
  26    int64_t bandwidth_limit;
  27    QEMUFile *file;
  28    int fd;
  29    int state;
  30    int (*get_error)(MigrationState *s);
  31    int (*close)(MigrationState *s);
  32    int (*write)(MigrationState *s, const void *buff, size_t size);
  33    void *opaque;
  34    int blk;
  35    int shared;
  36};
  37
  38void process_incoming_migration(QEMUFile *f);
  39
  40int qemu_start_incoming_migration(const char *uri, Error **errp);
  41
  42uint64_t migrate_max_downtime(void);
  43
  44void do_info_migrate_print(Monitor *mon, const QObject *data);
  45
  46void do_info_migrate(Monitor *mon, QObject **ret_data);
  47
  48int exec_start_incoming_migration(const char *host_port);
  49
  50int exec_start_outgoing_migration(MigrationState *s, const char *host_port);
  51
  52int tcp_start_incoming_migration(const char *host_port, Error **errp);
  53
  54int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
  55                                 Error **errp);
  56
  57int unix_start_incoming_migration(const char *path);
  58
  59int unix_start_outgoing_migration(MigrationState *s, const char *path);
  60
  61int fd_start_incoming_migration(const char *path);
  62
  63int fd_start_outgoing_migration(MigrationState *s, const char *fdname);
  64
  65void migrate_fd_error(MigrationState *s);
  66
  67void migrate_fd_connect(MigrationState *s);
  68
  69void add_migration_state_change_notifier(Notifier *notify);
  70void remove_migration_state_change_notifier(Notifier *notify);
  71bool migration_is_active(MigrationState *);
  72bool migration_has_finished(MigrationState *);
  73bool migration_has_failed(MigrationState *);
  74
  75uint64_t ram_bytes_remaining(void);
  76uint64_t ram_bytes_transferred(void);
  77uint64_t ram_bytes_total(void);
  78
  79int ram_save_live(QEMUFile *f, int stage, void *opaque);
  80int ram_load(QEMUFile *f, void *opaque, int version_id);
  81
  82/**
  83 * @migrate_add_blocker - prevent migration from proceeding
  84 *
  85 * @reason - an error to be returned whenever migration is attempted
  86 */
  87void migrate_add_blocker(Error *reason);
  88
  89/**
  90 * @migrate_del_blocker - remove a blocking error from migration
  91 *
  92 * @reason - the error blocking migration
  93 */
  94void migrate_del_blocker(Error *reason);
  95
  96#endif
  97