From patchwork Mon Jun 6 10:52:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9157835 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 D601760467 for ; Mon, 6 Jun 2016 10:54:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6A092665D for ; Mon, 6 Jun 2016 10:54:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBC0B26E82; Mon, 6 Jun 2016 10:54:16 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7AB212665D for ; Mon, 6 Jun 2016 10:54:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9s8p-0004Y7-Ar; Mon, 06 Jun 2016 10:52:19 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9s8o-0004XN-Fl for xen-devel@lists.xenproject.org; Mon, 06 Jun 2016 10:52:18 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id AE/C6-15969-1E555575; Mon, 06 Jun 2016 10:52:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsXitHSDve7D0NB wg1uz2Sy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxNd4sK5vJUbOr7xtbAOI+zi5GTQ0LAX+Lk 1smsIDabgLLEz85eNhBbREBPounAc0YQm1nAS+LHih52EFsYqP7puldgNouAisSdhpNgNbwCz hJ7tu9khpgpJ3H++E8wm1PAReLdth1g84WAaj50P2GBsBUkOqYfY4LoFZQ4ORMiziwgIXHwxQ uoOdwSt09PZZ7AyDcLSdksJGULGJlWMWoUpxaVpRbpGlroJRVlpmeU5CZm5ugaGhjr5aYWFye mp+YkJhXrJefnbmIEhlQ9AwPjDsbfpz0PMUpyMCmJ8sp+DQkX4kvKT6nMSCzOiC8qzUktPsQo w8GhJMFbExIaLiRYlJqeWpGWmQMMbpi0BAePkghvOUiat7ggMbc4Mx0idYpRUUqcVxIkIQCSy CjNg2uDRdQlRlkpYV5GBgYGIZ6C1KLczBJU+VeM4hyMSsK8a0Cm8GTmlcBNfwW0mAlo8bJrwS CLSxIRUlINjMJyesub0+u6co/4xe7J1Zl/bO6is0vfWTwMOPmVea+QQGXqyr/BM5gC3uvGr39 osclEJ/LFwdl12lblKuXSFVwFF3N3FbOcuskX/1D86snqA29263uqzol/Nq9B6Gl2WtXhm8xn Yv3zpNsmShxZMG2hTMzMu9mbVQ80dFrMS5VyXJVY6dqkqcRSnJFoqMVcVJwIALLxLxejAgAA X-Env-Sender: prvs=9584f9c1d=wei.liu2@citrix.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1465210334!43889358!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 409 invoked from network); 6 Jun 2016 10:52:16 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 6 Jun 2016 10:52:16 -0000 X-IronPort-AV: E=Sophos;i="5.26,426,1459814400"; d="scan'208";a="365458256" From: Wei Liu To: Xen-devel Date: Mon, 6 Jun 2016 11:52:07 +0100 Message-ID: <1465210332-25440-2-git-send-email-wei.liu2@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465210332-25440-1-git-send-email-wei.liu2@citrix.com> References: <1465210332-25440-1-git-send-email-wei.liu2@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH 1/6] xl: remus/colo: only initialise ha variable when necessary X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The original code is bogus because the common case is no HA enabled. Setting ha variable at the beginning is not very useful. Move ha to the scope where it is used. Signed-off-by: Wei Liu Acked-by: Ian Jackson --- tools/libxl/xl_cmdimpl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index d8530f0..c33691c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4752,8 +4752,6 @@ static void migrate_receive(int debug, int daemonize, int monitor, char rc_buf; char *migration_domname; struct domain_create dom_info; - const char *ha = checkpointed == LIBXL_CHECKPOINTED_STREAM_COLO ? - "COLO" : "Remus"; signal(SIGPIPE, SIG_IGN); /* if we get SIGPIPE we'd rather just have it as an error */ @@ -4788,6 +4786,9 @@ static void migrate_receive(int debug, int daemonize, int monitor, switch (checkpointed) { case LIBXL_CHECKPOINTED_STREAM_REMUS: case LIBXL_CHECKPOINTED_STREAM_COLO: + { + const char *ha = checkpointed == LIBXL_CHECKPOINTED_STREAM_COLO ? + "COLO" : "Remus"; /* If we are here, it means that the sender (primary) has crashed. * TODO: Split-Brain Check. */ @@ -4824,6 +4825,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, ha, common_domname, domid, rc); exit(rc ? EXIT_FAILURE : EXIT_SUCCESS); + } default: /* do nothing */ break;