From patchwork Mon Feb 22 02:52:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 8370731 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D15C79FC85 for ; Mon, 22 Feb 2016 02:54:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0B8E203C0 for ; Mon, 22 Feb 2016 02:54:33 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4B1C203A9 for ; Mon, 22 Feb 2016 02:54:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aXgbu-0001d7-O9; Mon, 22 Feb 2016 02:52:30 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aXgbn-0001Nz-7F for xen-devel@lists.xen.org; Mon, 22 Feb 2016 02:52:23 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id E1/8D-02988-6E77AC65; Mon, 22 Feb 2016 02:52:22 +0000 X-Env-Sender: wency@cn.fujitsu.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1456109537!23942833!2 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11315 invoked from network); 22 Feb 2016 02:52:21 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-9.tower-206.messagelabs.com with SMTP; 22 Feb 2016 02:52:21 -0000 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="3766087" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 22 Feb 2016 10:52:20 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 89F4E42AC851; Mon, 22 Feb 2016 10:50:28 +0800 (CST) Received: from G08FNSTD140052.g08.fujitsu.local (10.167.226.52) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 22 Feb 2016 10:52:19 +0800 From: Wen Congyang To: xen devel , Konrad Rzeszutek Wilk , Andrew Cooper , Ian Campbell , Ian Jackson , Wei Liu Date: Mon, 22 Feb 2016 10:52:34 +0800 Message-ID: <1456109555-28299-31-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456109555-28299-1-git-send-email-wency@cn.fujitsu.com> References: <1456109555-28299-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-yoursite-MailScanner-ID: 89F4E42AC851.A9F75 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wency@cn.fujitsu.com X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Cc: Lars Kurth , Changlong Xie , Wen Congyang , Gui Jianfeng , Jiang Yunhong , Dong Eddie , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v10 30/31] setup and control colo proxy on secondary side X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP setup and control colo proxy on secondary side Signed-off-by: Yang Hongyang Signed-off-by: Wen Congyang --- tools/libxl/libxl_colo_restore.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c index eff80ca..c4b1fb4 100644 --- a/tools/libxl/libxl_colo_restore.c +++ b/tools/libxl/libxl_colo_restore.c @@ -50,9 +50,11 @@ static void libxl__colo_restore_domain_checkpoint_callback(void *data); static void libxl__colo_restore_domain_wait_checkpoint_callback(void *data); static void libxl__colo_restore_domain_suspend_callback(void *data); +extern const libxl__checkpoint_device_instance_ops colo_restore_device_nic; extern const libxl__checkpoint_device_instance_ops colo_restore_device_qdisk; static const libxl__checkpoint_device_instance_ops *colo_restore_ops[] = { + &colo_restore_device_nic, &colo_restore_device_qdisk, NULL, }; @@ -153,8 +155,14 @@ static int init_device_subkind(libxl__checkpoint_devices_state *cds) int rc; STATE_AO_GC(cds->ao); + rc = init_subkind_colo_nic(cds); + if (rc) goto out; + rc = init_subkind_qdisk(cds); - if (rc) goto out; + if (rc) { + cleanup_subkind_colo_nic(cds); + goto out; + } rc = 0; out: @@ -166,6 +174,7 @@ static void cleanup_device_subkind(libxl__checkpoint_devices_state *cds) /* cleanup device subkind-specific state in the libxl ctx */ STATE_AO_GC(cds->ao); + cleanup_subkind_colo_nic(cds); cleanup_subkind_qdisk(cds); } @@ -347,6 +356,8 @@ static void colo_restore_teardown_devices_done(libxl__egc *egc, if (crcs->teardown_devices) cleanup_device_subkind(cds); + colo_proxy_teardown(&crs->cps); + rc = crcs->saved_rc; if (!rc) { crcs->callback = do_failover_done; @@ -605,6 +616,8 @@ static void colo_restore_preresume_cb(libxl__egc *egc, } } + colo_proxy_preresume(&crs->cps); + colo_restore_resume_vm(egc, crcs); return; @@ -641,6 +654,8 @@ static void colo_resume_vm_done(libxl__egc *egc, crcs->status = LIBXL_COLO_RESUMED; + colo_proxy_postresume(&crs->cps); + /* avoid calling stream->completion_callback() more than once */ if (crs->saved_cb) { dcs->callback = crs->saved_cb; @@ -762,13 +777,20 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc, STATE_AO_GC(crs->ao); - /* TODO: nic support */ - cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VBD); + cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) | + (1 << LIBXL__DEVICE_KIND_VBD); cds->callback = colo_restore_setup_cds_done; cds->ao = ao; cds->domid = crs->domid; cds->ops = colo_restore_ops; + crs->cps.ao = ao; + if (colo_proxy_setup(&crs->cps)) { + LOG(ERROR, "COLO: failed to setup colo proxy for guest with domid %u", + cds->domid); + goto out; + } + if (init_device_subkind(cds)) goto out;