From patchwork Thu Sep 29 11:06:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 9356355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCDC46077B for ; Thu, 29 Sep 2016 11:11:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDBC62990D for ; Thu, 29 Sep 2016 11:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C28E329954; Thu, 29 Sep 2016 11:11:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58BBC2990D for ; Thu, 29 Sep 2016 11:11:44 +0000 (UTC) Received: from localhost ([::1]:36438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpZFf-0003Pv-Bo for patchwork-qemu-devel@patchwork.kernel.org; Thu, 29 Sep 2016 07:11:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpZD6-0001oN-Ti for qemu-devel@nongnu.org; Thu, 29 Sep 2016 07:09:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpZD1-0007v5-Q2 for qemu-devel@nongnu.org; Thu, 29 Sep 2016 07:09:03 -0400 Received: from [59.151.112.132] (port=21339 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpZCy-0007rr-RA for qemu-devel@nongnu.org; Thu, 29 Sep 2016 07:08:59 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="11523950" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 29 Sep 2016 19:08:39 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id ED490466F726; Thu, 29 Sep 2016 19:08:37 +0800 (CST) Received: from G08FNSTD140138.localdomain (10.167.226.45) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.279.2; Thu, 29 Sep 2016 19:08:37 +0800 From: Li Zhijian To: , , Date: Thu, 29 Sep 2016 19:06:32 +0800 Message-ID: <1475147192-31228-2-git-send-email-lizhijian@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475147192-31228-1-git-send-email-lizhijian@cn.fujitsu.com> References: <1475147192-31228-1-git-send-email-lizhijian@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.45] X-yoursite-MailScanner-ID: ED490466F726.AD68E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lizhijian@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Subject: [Qemu-devel] [PATCH 2/2] migration: send and check the devices between source and distination at the begining X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Zhijian Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Priviously, if the source and distination have different devices, source could goto the status "paused (postmigrate)", and the distination will exit that means no qemu is alive. After this patch, at above case, source can dectect the some error early from distination and stop the migration, source keep in status "running". Signed-off-by: Li Zhijian --- migration/savevm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 09d8e99..0c07671 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -887,6 +887,7 @@ void qemu_savevm_state_begin(QEMUFile *f, trace_savevm_state_begin(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + save_section_header(f, se, QEMU_VM_SECTION_START); if (!se->ops || !se->ops->set_params) { continue; } @@ -902,7 +903,7 @@ void qemu_savevm_state_begin(QEMUFile *f, continue; } } - save_section_header(f, se, QEMU_VM_SECTION_START); + save_section_header(f, se, QEMU_VM_SECTION_FULL); ret = se->ops->save_live_setup(f, se->opaque); save_section_footer(f, se); @@ -1775,7 +1776,7 @@ qemu_loadvm_section_start(QEMUFile *f, MigrationIncomingState *mis, } static int -qemu_loadvm_section_full(QEMUFile *f, MigrationIncomingState *mis) +qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis) { uint32_t version_id, section_id; SaveStateEntry *se; @@ -1846,14 +1847,21 @@ static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis) { uint8_t section_type; int ret; + SaveStateEntry *se; + uint32_t instance, version; while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) { trace_qemu_loadvm_state_section(section_type); switch (section_type) { case QEMU_VM_SECTION_START: + ret = qemu_loadvm_section_start(f, mis, &se, &instance, &version); + if (ret < 0) { + return ret; + } + break; case QEMU_VM_SECTION_FULL: - ret = qemu_loadvm_section_full(f, mis); + ret = qemu_loadvm_section_start_full(f, mis); if (ret < 0) { return ret; }