From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> Suspend to file is very much like a migrate, and it makes life easier if we have the Migration state available, so initialise it in the savevm.c code for suspending.
Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> --- include/migration/migration.h | 1 + include/qemu/typedefs.h | 1 + migration.c | 2 +- savevm.c | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index e3f4494..bbb616e 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -141,6 +141,7 @@ int migrate_fd_close(MigrationState *s); void add_migration_state_change_notifier(Notifier *notify); void remove_migration_state_change_notifier(Notifier *notify); +MigrationState *migrate_init(const MigrationParams *params); bool migration_in_setup(MigrationState *); bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 0f79b5c..8539de6 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -16,6 +16,7 @@ struct Monitor; typedef struct Monitor Monitor; typedef struct MigrationIncomingState MigrationIncomingState; typedef struct MigrationParams MigrationParams; +typedef struct MigrationState MigrationState; typedef struct Property Property; typedef struct PropertyInfo PropertyInfo; diff --git a/migration.c b/migration.c index bd7071a..500de77 100644 --- a/migration.c +++ b/migration.c @@ -462,7 +462,7 @@ bool migration_has_failed(MigrationState *s) s->state == MIG_STATE_ERROR); } -static MigrationState *migrate_init(const MigrationParams *params) +MigrationState *migrate_init(const MigrationParams *params) { MigrationState *s = migrate_get_current(); int64_t bandwidth_limit = s->bandwidth_limit; diff --git a/savevm.c b/savevm.c index 171676d..809bd04 100644 --- a/savevm.c +++ b/savevm.c @@ -941,6 +941,8 @@ static int qemu_savevm_state(QEMUFile *f) .blk = 0, .shared = 0 }; + MigrationState *ms = migrate_init(¶ms); + ms->file = f; if (qemu_savevm_state_blocked(NULL)) { return -EINVAL; -- 1.9.3