Received: from eggs.gnu.org ([2001:4830:134:3::10]:60530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbZq0-0007Vd-Gl for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbZpx-0005zn-C7 for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:24 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:32777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbZpx-0005zh-5T for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:21 -0400 Received: by mail-pf0-x243.google.com with SMTP id i6so5031241pfe.0 for ; Sun, 21 Aug 2016 13:59:20 -0700 (PDT) From: Md Haris Iqbal Date: Mon, 22 Aug 2016 02:28:51 +0530 Message-Id: <1471813132-13836-6-git-send-email-haris.phnx@gmail.com> In-Reply-To: <1471813132-13836-1-git-send-email-haris.phnx@gmail.com> References: <1471813132-13836-1-git-send-email-haris.phnx@gmail.com> Subject: [Qemu-devel] [PATCH 5/6] Migration: Recovering pages lost due to n/w failure during pc migration (source) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dgilbert@redhat.com, Md Haris Iqbal Signed-off-by: Md Haris Iqbal --- include/migration/migration.h | 5 +++++ migration/migration.c | 2 ++ migration/savevm.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index 4e4c0c8..5533832 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -145,6 +145,11 @@ struct MigrationState int state; /* Old style params from 'migrate' command */ MigrationParams params; + /* + * Don't need 2 variables for recovery. + * Clean this up, use a single variable with different states. + */ + bool recovered_once; bool in_recovery; /* State related to return path */ diff --git a/migration/migration.c b/migration/migration.c index 7cd3344..6faa483 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1042,6 +1042,7 @@ MigrationState *migrate_init(const MigrationParams *params) s->xfer_limit = 0; s->cleanup_bh = 0; s->to_dst_file = NULL; + s->recovered_once = false; s->in_recovery = false; s->state = MIGRATION_STATUS_NONE; s->params = *params; @@ -1925,6 +1926,7 @@ static void *migration_thread(void *opaque) if(ret == 0) { current_active_state = MIGRATION_STATUS_POSTCOPY_ACTIVE; runstate_set(RUN_STATE_FINISH_MIGRATE); + s->recovered_once = true; qemu_file_clear_error(s->to_dst_file); continue; } diff --git a/migration/savevm.c b/migration/savevm.c index 79f601c..aa4f777 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -986,6 +986,11 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) { SaveStateEntry *se; int ret; + MigrationState *ms = migrate_get_current(); + + if (ms->recovered_once) { + qemu_savevm_command_send(f, MIG_CMD_POSTCOPY_RECOVERY, 0, NULL); + } QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_live_complete_postcopy) { -- 2.7.4