diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2015-11-05 18:10:40 +0000 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2015-11-10 14:51:49 +0100 |
commit | aefeb18bde45fa629e3055a7bb6637a7dcad8c36 (patch) | |
tree | 8086912133e1f0e5f161c2a4ffaa63edba7d206c | |
parent | a776aa15a7e3e08964c6c537314b9590dde27b4d (diff) | |
download | qemu-aefeb18bde45fa629e3055a7bb6637a7dcad8c36.zip qemu-aefeb18bde45fa629e3055a7bb6637a7dcad8c36.tar.gz qemu-aefeb18bde45fa629e3055a7bb6637a7dcad8c36.tar.bz2 |
migrate_init: Call from savevm
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 <dgilbert@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewd-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r-- | include/migration/migration.h | 4 | ||||
-rw-r--r-- | include/qemu/typedefs.h | 1 | ||||
-rw-r--r-- | migration/migration.c | 2 | ||||
-rw-r--r-- | migration/savevm.c | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/include/migration/migration.h b/include/migration/migration.h index 51bc348..82cc3a6 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -42,10 +42,7 @@ struct MigrationParams { bool shared; }; -typedef struct MigrationState MigrationState; - typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head; - /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -116,6 +113,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 4338767..f7e0ed0 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -44,6 +44,7 @@ typedef struct MemoryRegion MemoryRegion; typedef struct MemoryRegionSection MemoryRegionSection; typedef struct MigrationIncomingState MigrationIncomingState; typedef struct MigrationParams MigrationParams; +typedef struct MigrationState MigrationState; typedef struct Monitor Monitor; typedef struct MouseTransformInfo MouseTransformInfo; typedef struct MSIMessage MSIMessage; diff --git a/migration/migration.c b/migration/migration.c index 6fef544..82efbeb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -682,7 +682,7 @@ bool migration_has_failed(MigrationState *s) s->state == MIGRATION_STATUS_FAILED); } -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/migration/savevm.c b/migration/savevm.c index 638aa1f..9dc57d3 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -922,6 +922,8 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) .blk = 0, .shared = 0 }; + MigrationState *ms = migrate_init(¶ms); + ms->file = f; if (qemu_savevm_state_blocked(errp)) { return -EINVAL; |