migration: pass MigrationState to migrate_init()

Let the callers take the object, then pass it to migrate_init().

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180208103132.28452-12-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Peter Xu 2018-02-08 18:31:15 +08:00 committed by Dr. David Alan Gilbert
parent d6208e35e4
commit 3e0c8050eb
3 changed files with 7 additions and 7 deletions

View File

@ -1258,10 +1258,8 @@ bool migration_is_idle(void)
return false;
}
MigrationState *migrate_init(void)
void migrate_init(MigrationState *s)
{
MigrationState *s = migrate_get_current();
/*
* Reinitialise all migration state, except
* parameters/capabilities that the user set, and
@ -1291,7 +1289,6 @@ MigrationState *migrate_init(void)
s->vm_was_running = false;
s->iteration_initial_bytes = 0;
s->threshold_size = 0;
return s;
}
static GSList *migration_blockers;
@ -1399,7 +1396,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
migrate_set_block_incremental(s, true);
}
s = migrate_init();
migrate_init(s);
if (strstart(uri, "tcp:", &p)) {
tcp_start_outgoing_migration(s, p, &local_err);

View File

@ -193,7 +193,7 @@ void migrate_fd_error(MigrationState *s, const Error *error);
void migrate_fd_connect(MigrationState *s, Error *error_in);
MigrationState *migrate_init(void);
void migrate_init(MigrationState *s);
bool migration_is_blocked(Error **errp);
/* True if outgoing migration has entered postcopy phase */
bool migration_in_postcopy(void);

View File

@ -1257,8 +1257,11 @@ void qemu_savevm_state_cleanup(void)
static int qemu_savevm_state(QEMUFile *f, Error **errp)
{
int ret;
MigrationState *ms = migrate_init();
MigrationState *ms = migrate_get_current();
MigrationStatus status;
migrate_init(ms);
ms->to_dst_file = f;
if (migration_is_blocked(errp)) {