From patchwork Thu Feb 28 16:55:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 1049622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 449Jgh5FxKz9s0W for ; Fri, 1 Mar 2019 03:59:39 +1100 (AEDT) Received: from localhost ([127.0.0.1]:42956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzP20-0005QE-Nk for incoming@patchwork.ozlabs.org; Thu, 28 Feb 2019 11:59:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzP1D-0005OK-9A for qemu-devel@nongnu.org; Thu, 28 Feb 2019 11:58:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzP1B-0007L6-9Q for qemu-devel@nongnu.org; Thu, 28 Feb 2019 11:58:46 -0500 Received: from mga17.intel.com ([192.55.52.151]:63406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gzP1A-0007D6-RG for qemu-devel@nongnu.org; Thu, 28 Feb 2019 11:58:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 08:58:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,423,1544515200"; d="scan'208";a="142431797" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001.jf.intel.com with ESMTP; 28 Feb 2019 08:58:41 -0800 From: Zhang Chen To: Li Zhijian , Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Markus Armbruster , Eric Blake , qemu-dev Date: Fri, 1 Mar 2019 00:55:07 +0800 Message-Id: <20190228165508.21594-7-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190228165508.21594-1-chen.zhang@intel.com> References: <20190228165508.21594-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.151 Subject: [Qemu-devel] [PATCH V2 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Zhang Chen Signed-off-by: Zhang Chen --- 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"); } }