From patchwork Sun Mar 3 14:50:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D16D1390 for ; Sun, 3 Mar 2019 15:14:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 771A428B55 for ; Sun, 3 Mar 2019 15:14:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64F2E28B74; Sun, 3 Mar 2019 15:14:07 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1644E28B55 for ; Sun, 3 Mar 2019 15:14:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:40544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SoY-00031C-Bs for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:14:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiO-0005ua-PT for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SUu-00065R-MK for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:42884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SUu-0005wf-CD for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:48 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005917" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:45 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:15 +0800 Message-Id: <20190303145021.2962-2-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 1/7] Migration/colo.c: Fix double close bug when occur COLO failover 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen In migration_incoming_state_destroy(void) will check the mis->to_src_file to double close the mis->to_src_file when occur COLO failover. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/colo.c b/migration/colo.c index 398b239d1c..a916dc178c 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -872,6 +872,7 @@ out: /* Must be called after failover BH is completed */ if (mis->to_src_file) { qemu_fclose(mis->to_src_file); + mis->to_src_file = NULL; } migration_incoming_disable_colo(); From patchwork Sun Mar 3 14:50:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CD70139A for ; Sun, 3 Mar 2019 15:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A3F12A1DB for ; Sun, 3 Mar 2019 15:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9862A1DD; Sun, 3 Mar 2019 15:11:58 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF0B82A1DB for ; Sun, 3 Mar 2019 15:11:57 +0000 (UTC) Received: from localhost ([127.0.0.1]:40530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SmT-0001Qr-33 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:11:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiO-0006Fd-P4 for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SUv-00066T-56 for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:42882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SUu-0005rf-Su for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005922" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:46 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:16 +0800 Message-Id: <20190303145021.2962-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 2/7] Migration/colo.c: Fix COLO failover status error 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen When finished COLO failover, the status is FAILOVER_STATUS_COMPLETED. The origin codes misunderstand the FAILOVER_STATUS_REQUIRE. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index a916dc178c..a13acac192 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -121,6 +121,7 @@ static void secondary_vm_do_failover(void) } /* Notify COLO incoming thread that failover work is finished */ qemu_sem_post(&mis->colo_incoming_sem); + /* For Secondary VM, jump to incoming co */ if (mis->migration_incoming_co) { qemu_coroutine_enter(mis->migration_incoming_co); @@ -262,7 +263,7 @@ COLOStatus *qmp_query_colo_status(Error **errp) case FAILOVER_STATUS_NONE: s->reason = COLO_EXIT_REASON_NONE; break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: s->reason = COLO_EXIT_REASON_REQUEST; break; default: @@ -582,7 +583,7 @@ out: qapi_event_send_colo_exit(COLO_MODE_PRIMARY, COLO_EXIT_REASON_ERROR); break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_PRIMARY, COLO_EXIT_REASON_REQUEST); break; @@ -854,7 +855,7 @@ out: qapi_event_send_colo_exit(COLO_MODE_SECONDARY, COLO_EXIT_REASON_ERROR); break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_SECONDARY, COLO_EXIT_REASON_REQUEST); break; From patchwork Sun Mar 3 14:50:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 071D1139A for ; Sun, 3 Mar 2019 15:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2C162A1DB for ; Sun, 3 Mar 2019 15:11:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1E072A1DD; Sun, 3 Mar 2019 15:11:55 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B4502A1DB for ; Sun, 3 Mar 2019 15:11:55 +0000 (UTC) Received: from localhost ([127.0.0.1]:40526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SmQ-0001Oj-FP for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:11:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiO-0005yq-OH for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SUx-0006Cl-6i for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:51 -0500 Received: from mga09.intel.com ([134.134.136.24]:42887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SUw-00068j-SN for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:51 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005927" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:48 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:17 +0800 Message-Id: <20190303145021.2962-4-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 3/7] Migration/colo.c: Make COLO node running after failover 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen Delay to close COLO for auto start VM after failover. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 1 - migration/migration.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/colo.c b/migration/colo.c index a13acac192..89325952c7 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -875,7 +875,6 @@ out: qemu_fclose(mis->to_src_file); mis->to_src_file = NULL; } - migration_incoming_disable_colo(); rcu_unregister_thread(); return NULL; diff --git a/migration/migration.c b/migration/migration.c index 37e06b76dc..cec5f529c3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -383,6 +383,9 @@ static void process_incoming_migration_bh(void *opaque) } else { runstate_set(RUN_STATE_PAUSED); } + } else if (migration_incoming_colo_enabled()) { + migration_incoming_disable_colo(); + vm_start(); } else { runstate_set(global_state_get_runstate()); } From patchwork Sun Mar 3 14:50:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE5381390 for ; Sun, 3 Mar 2019 15:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE21B2A1AD for ; Sun, 3 Mar 2019 15:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A24BA2A1AF; Sun, 3 Mar 2019 15:09:24 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5817D2A1AD for ; Sun, 3 Mar 2019 15:09:23 +0000 (UTC) Received: from localhost ([127.0.0.1]:40475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0Sjy-0007iJ-59 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:09:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiM-0005uk-PV for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SUz-0006Pz-Tu for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:54 -0500 Received: from mga09.intel.com ([134.134.136.24]:42887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SUz-00068j-L5 for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005942" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:51 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:19 +0800 Message-Id: <20190303145021.2962-6-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 5/7] qapi/migration.json: Remove a variable that doesn't exist in example 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen Remove the "active" variable in example for query-colo-status. It is a doc bug from commit f56c0065 Signed-off-by: Zhang Chen Reviewed-by: Eric Blake --- qapi/migration.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index 089ed67807..18929f1154 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1342,7 +1342,7 @@ # Example: # # -> { "execute": "query-colo-status" } -# <- { "return": { "mode": "primary", "active": true, "reason": "request" } } +# <- { "return": { "mode": "primary", "reason": "request" } } # # Since: 3.1 ## From patchwork Sun Mar 3 14:50:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 505C9139A for ; Sun, 3 Mar 2019 15:09:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22AD72A1A7 for ; Sun, 3 Mar 2019 15:09:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16A8F2A1AE; Sun, 3 Mar 2019 15:09:26 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2B462A1A7 for ; Sun, 3 Mar 2019 15:09:25 +0000 (UTC) Received: from localhost ([127.0.0.1]:40481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0Sk1-0007lE-44 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:09:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiM-0005ua-OA for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SV1-0006WV-Kn for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:56 -0500 Received: from mga09.intel.com ([134.134.136.24]:42887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SV1-00068j-BP for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:55 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005946" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:53 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:20 +0800 Message-Id: <20190303145021.2962-7-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 6/7] Migration/colo.c: Add the necessary checks for colo_do_failover 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index dbe2b88807..d1ae2e6d11 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -197,10 +197,16 @@ void colo_do_failover(MigrationState *s) vm_stop_force_state(RUN_STATE_COLO); } - if (get_colo_mode() == COLO_MODE_PRIMARY) { + switch (get_colo_mode()) { + case COLO_MODE_PRIMARY: primary_vm_do_failover(); - } else { + break; + case COLO_MODE_SECONDARY: secondary_vm_do_failover(); + break; + default: + error_report("colo_do_failover failed because the colo mode" + " could not be obtained"); } } From patchwork Sun Mar 3 14:50:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 10837067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB16C1390 for ; Sun, 3 Mar 2019 15:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B71D62A1DB for ; Sun, 3 Mar 2019 15:11:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB6072A1DD; Sun, 3 Mar 2019 15:11:56 +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=-0.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI autolearn=no version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 60F7B2A1DB for ; Sun, 3 Mar 2019 15:11:56 +0000 (UTC) Received: from localhost ([127.0.0.1]:40528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SmR-0001Pu-HT for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Mar 2019 10:11:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0SiM-0005yq-O8 for qemu-devel@nongnu.org; Sun, 03 Mar 2019 10:07:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0SV3-0006ik-BK for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:58 -0500 Received: from mga09.intel.com ([134.134.136.24]:42887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0SV3-00068j-1o for qemu-devel@nongnu.org; Sun, 03 Mar 2019 09:53:57 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 06:53:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,436,1544515200"; d="scan'208";a="325005950" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2019 06:53:55 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Sun, 3 Mar 2019 22:50:21 +0800 Message-Id: <20190303145021.2962-8-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190303145021.2962-1-chen.zhang@intel.com> References: <20190303145021.2962-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH V3 7/7] Migration/colo.c: Make user obtain the COLO mode info after failover 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: Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen Add the last_colo_mode to save the status after failover. This patch can solve the issue that user got nothing to call query_colo_status after failover. Signed-off-by: Zhang Chen --- migration/colo.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index d1ae2e6d11..6eba8e06f2 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -38,6 +38,9 @@ static bool vmstate_loading; static Notifier packets_compare_notifier; +/* User need to know colo mode after COLO failover */ +static COLOMode last_colo_mode; + #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024) bool migration_in_colo_state(void) @@ -197,7 +200,10 @@ void colo_do_failover(MigrationState *s) vm_stop_force_state(RUN_STATE_COLO); } - switch (get_colo_mode()) { + /* Update last_COLO_mode to avoid unexpectedly exit COLO status */ + last_colo_mode = get_colo_mode(); + + switch (last_colo_mode) { case COLO_MODE_PRIMARY: primary_vm_do_failover(); break; @@ -263,7 +269,7 @@ COLOStatus *qmp_query_colo_status(Error **errp) { COLOStatus *s = g_new0(COLOStatus, 1); - s->mode = get_colo_mode(); + s->mode = last_colo_mode; switch (failover_get_state()) { case FAILOVER_STATUS_NONE: @@ -515,6 +521,12 @@ static void colo_process_checkpoint(MigrationState *s) Error *local_err = NULL; int ret; + last_colo_mode = get_colo_mode(); + if (last_colo_mode != COLO_MODE_PRIMARY) { + error_report("COLO mode must be COLO_MODE_PRIMARY"); + return; + } + failover_init_state(); s->rp_state.from_dst_file = qemu_file_get_return_path(s->to_dst_file); @@ -682,12 +694,18 @@ void *colo_process_incoming_thread(void *opaque) Error *local_err = NULL; int ret; - rcu_register_thread(); - qemu_sem_init(&mis->colo_incoming_sem, 0); - migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); + last_colo_mode = get_colo_mode(); + if (last_colo_mode != COLO_MODE_SECONDARY) { + error_report("COLO mode must be COLO_MODE_SECONDARY"); + return NULL; + } + + rcu_register_thread(); + qemu_sem_init(&mis->colo_incoming_sem, 0); + failover_init_state(); mis->to_src_file = qemu_file_get_return_path(mis->from_src_file);