qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com,
	groug@kaod.org, ross.lagerwall@citrix.com
Subject: [Qemu-devel] [PULL 10/10] migration: pass MigrationState to migrate_init()
Date: Wed, 14 Feb 2018 15:39:38 +0000	[thread overview]
Message-ID: <20180214153938.5410-11-dgilbert@redhat.com> (raw)
In-Reply-To: <20180214153938.5410-1-dgilbert@redhat.com>

From: Peter Xu <peterx@redhat.com>

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>
---
 migration/migration.c | 7 ++-----
 migration/migration.h | 2 +-
 migration/savevm.c    | 5 ++++-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 913f658c3e..0aa596f867 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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);
diff --git a/migration/migration.h b/migration/migration.h
index f515b8994f..82cf926b17 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -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);
diff --git a/migration/savevm.c b/migration/savevm.c
index 967c3bca0d..8e6d872452 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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)) {
-- 
2.14.3

  parent reply	other threads:[~2018-02-14 15:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 15:39 [Qemu-devel] [PULL 00/10] migration queue Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 01/10] migration/xen: Check return value of qemu_fclose Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 02/10] migration: improve documentation of postcopy-ram Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 03/10] tests/migration: Add source to PC boot block Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 04/10] migration: Fix early failure cleanup Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 05/10] tests/migration: Add test for migration to bad destination Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 06/10] migration: better error handling with QEMUFile Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 07/10] migration: reuse mis->userfault_quit_fd Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 08/10] migration: provide postcopy_fault_thread_notify() Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` [Qemu-devel] [PULL 09/10] migration: allow send_rq to fail Dr. David Alan Gilbert (git)
2018-02-14 15:39 ` Dr. David Alan Gilbert (git) [this message]
2018-02-15 15:45 ` [Qemu-devel] [PULL 00/10] migration queue Peter Maydell
2018-02-15 20:19   ` Dr. David Alan Gilbert
2018-02-16  6:14     ` Thomas Huth
2018-02-16 14:25 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180214153938.5410-11-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=groug@kaod.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=ross.lagerwall@citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).