From patchwork Thu Jan 26 06:36:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 9538371 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 86136604A0 for ; Thu, 26 Jan 2017 06:41:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7336E1FF35 for ; Thu, 26 Jan 2017 06:41:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67B3E205AF; Thu, 26 Jan 2017 06:41:25 +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 01D2E1FF35 for ; Thu, 26 Jan 2017 06:41:25 +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 1cWdgh-0007Nv-5A; Thu, 26 Jan 2017 06:37:39 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWdgf-0007NP-Kn for xen-devel@lists.xenproject.org; Thu, 26 Jan 2017 06:37:37 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 22/EE-13192-13999885; Thu, 26 Jan 2017 06:37:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRWlGSWpSXmKPExsViPb2gRddgZme EQed6EYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNeP41QWsBds0Kp6v3c/ewHhAvouRk0NCwE/i 6a/TLCC2kECtRMuaG0xdjFxA9kpGiZ/3t7NAOLsYJXp7ljKCVLEJGEjMuTIRzBYRKJe4dn0tW AezwElGiU1TV7GDJISBxvb0zGECsVkEVCX+/ZnPBmLzCvhILP3ZzQyxWk7i5rlOMJtTwFdi2f bZUGf4SKxZdB6qXlDi5MwnYHFmAQmJgy9eANVzAPUqSrRd44UYoytxZdEVRghbU2Lb6nNsECV WElO3ekKEBSV2Pr/ANoFRZBaSobOQDF3AyLSKUaM4tagstUjXyFgvqSgzPaMkNzEzR9fQwEwv N7W4ODE9NScxqVgvOT93EyMwzBmAYAfjn/mBhxglOZiURHlvandGCPEl5adUZiQWZ8QXleakF h9ilOHgUJLgNZsBlBMsSk1PrUjLzAFGHExagoNHSYT3/3SgNG9xQWJucWY6ROoUo6KUOG86SJ 8ASCKjNA+uDRbllxhlpYR5GYEOEeIpSC3KzSxBlX/FKM7BqCTMuxFkCk9mXgnc9FdAi5mAFl9 gbgdZXJKIkJJqYLTU2nVw2qwp3+efPSEo/2L+o90iamxO9pclslbPlX1cGy3hd+XbruedrGpf hDrzkpmP1zU+CTLKL6w14Xbv1Z+SczCj56ieznH7NfHy1ger9i99LXIiU+nLOq5fhms+fhV5m /Sp+JHh1TQrTzVpG55y5SlTl1zwPTIpPu3CiYv38idMcHuZPV+JpTgj0VCLuag4EQAfAhcj7Q IAAA== X-Env-Sender: zhangchen.fnst@cn.fujitsu.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1485412650!31510954!2 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45569 invoked from network); 26 Jan 2017 06:37:35 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-6.tower-21.messagelabs.com with SMTP; 26 Jan 2017 06:37:35 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="15111291" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Jan 2017 14:37:33 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 0083747B1502; Thu, 26 Jan 2017 14:37:29 +0800 (CST) Received: from localhost.localdomain (10.167.226.56) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 26 Jan 2017 14:37:29 +0800 From: Zhang Chen To: Xen devel , Ian Jackson , Wei Liu Date: Thu, 26 Jan 2017 14:36:04 +0800 Message-ID: <1485412569-7431-2-git-send-email-zhangchen.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485412569-7431-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> References: <1485412569-7431-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.56] X-yoursite-MailScanner-ID: 0083747B1502.A9095 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhangchen.fnst@cn.fujitsu.com Cc: "eddie . dong" , Yang Hongyang , Bian Naimeng , Li Zhijian , Zhang Chen Subject: [Xen-devel] [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy 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 Add remus '-p' to enable userspace colo proxy(in qemu). Signed-off-by: Zhang Chen --- docs/man/xl.pod.1.in | 4 ++++ tools/libxl/libxl_colo.h | 5 +++++ tools/libxl/libxl_colo_save.c | 2 ++ tools/libxl/libxl_types.idl | 17 +++++++++-------- tools/libxl/xl_cmdimpl.c | 13 ++++++++++++- tools/libxl/xl_cmdtable.c | 3 ++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in index 09c1faa..b5fb7c1 100644 --- a/docs/man/xl.pod.1.in +++ b/docs/man/xl.pod.1.in @@ -553,6 +553,10 @@ Disable disk replication. Requires enabling unsafe mode. Enable COLO HA. This conflicts with B<-i> and B<-b>, and memory checkpoint compression must be disabled. +=item B<-p> + +Enable userspace COLO Proxy. Must open with B<-c>. + =back =item B I diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h index 682275c..4746d8c 100644 --- a/tools/libxl/libxl_colo.h +++ b/tools/libxl/libxl_colo.h @@ -64,6 +64,11 @@ struct libxl__colo_proxy_state { int sock_fd; int index; + /* + * Private, True means use userspace colo proxy + * False means use kernel colo proxy. + */ + bool is_userspace_proxy; }; struct libxl__colo_save_state { diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c index 6277770..eb8336c 100644 --- a/tools/libxl/libxl_colo_save.c +++ b/tools/libxl/libxl_colo_save.c @@ -101,6 +101,8 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css) css->qdisk_setuped = false; css->qdisk_used = false; libxl__ev_child_init(&css->child); + css->cps.is_userspace_proxy = + libxl_defbool_val(dss->remus->userspace_colo_proxy); if (dss->remus->netbufscript) css->colo_proxy_script = libxl__strdup(gc, dss->remus->netbufscript); diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index a612d1f..1bd2057 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -844,14 +844,15 @@ libxl_sched_credit2_params = Struct("sched_credit2_params", [ ], dispose_fn=None) libxl_domain_remus_info = Struct("domain_remus_info",[ - ("interval", integer), - ("allow_unsafe", libxl_defbool), - ("blackhole", libxl_defbool), - ("compression", libxl_defbool), - ("netbuf", libxl_defbool), - ("netbufscript", string), - ("diskbuf", libxl_defbool), - ("colo", libxl_defbool) + ("interval", integer), + ("allow_unsafe", libxl_defbool), + ("blackhole", libxl_defbool), + ("compression", libxl_defbool), + ("netbuf", libxl_defbool), + ("netbufscript", string), + ("diskbuf", libxl_defbool), + ("colo", libxl_defbool), + ("userspace_colo_proxy", libxl_defbool) ]) libxl_event_type = Enumeration("event_type", [ diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7e8a8ae..905c5f6 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -8893,7 +8893,7 @@ int main_remus(int argc, char **argv) memset(&r_info, 0, sizeof(libxl_domain_remus_info)); - SWITCH_FOREACH_OPT(opt, "Fbundi:s:N:ec", NULL, "remus", 2) { + SWITCH_FOREACH_OPT(opt, "Fbundi:s:N:ecp", NULL, "remus", 2) { case 'i': r_info.interval = atoi(optarg); break; @@ -8923,6 +8923,9 @@ int main_remus(int argc, char **argv) break; case 'c': libxl_defbool_set(&r_info.colo, true); + break; + case 'p': + libxl_defbool_set(&r_info.userspace_colo_proxy, true); } domid = find_domain(argv[optind]); @@ -8931,9 +8934,17 @@ int main_remus(int argc, char **argv) /* Defaults */ libxl_defbool_setdefault(&r_info.blackhole, false); libxl_defbool_setdefault(&r_info.colo, false); + libxl_defbool_setdefault(&r_info.userspace_colo_proxy, false); + if (!libxl_defbool_val(r_info.colo) && !r_info.interval) r_info.interval = 200; + if (libxl_defbool_val(r_info.userspace_colo_proxy) && + !libxl_defbool_val(r_info.colo)) { + perror("option -p must open with -c"); + exit(-1); + } + if (libxl_defbool_val(r_info.colo)) { if (r_info.interval || libxl_defbool_val(r_info.blackhole) || !libxl_defbool_is_default(r_info.netbuf) || diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 588d5d9..a124059 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -506,7 +506,8 @@ struct cmd_spec cmd_table[] = { "-n Disable network output buffering. Works only in unsafe mode.\n" "-d Disable disk replication. Works only in unsafe mode.\n" "-c Enable COLO HA. It is conflict with -i and -b, and memory\n" - " checkpoint must be disabled" + " checkpoint must be disabled.\n" + "-p Enable COLO userspace proxy." }, #endif { "devd",