All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: Xen devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>
Cc: "eddie . dong" <eddie.dong@intel.com>,
	Yang Hongyang <imhy.yang@gmail.com>,
	Bian Naimeng <biannm@cn.fujitsu.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Subject: [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side
Date: Thu, 26 Jan 2017 14:36:05 +0800	[thread overview]
Message-ID: <1485412569-7431-3-git-send-email-zhangchen.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1485412569-7431-1-git-send-email-zhangchen.fnst@cn.fujitsu.com>

In this patch we close kernel COLO-Proxy on primary side.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 tools/libxl/libxl_colo_proxy.c | 30 ++++++++++++++++++++++++++++++
 tools/libxl/libxl_colo_save.c  |  9 +++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index 0983f42..348484d 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -152,6 +152,11 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)
 
     STATE_AO_GC(cps->ao);
 
+    if (cps->is_userspace_proxy) {
+        /* If enable userspace proxy mode, we don't need setup kernel proxy */
+        return 0;
+    }
+
     skfd = socket(PF_NETLINK, SOCK_RAW, NETLINK_COLO);
     if (skfd < 0) {
         LOGD(ERROR, ao->domid, "can not create a netlink socket: %s", strerror(errno));
@@ -222,6 +227,14 @@ out:
 
 void colo_proxy_teardown(libxl__colo_proxy_state *cps)
 {
+    if (cps->is_userspace_proxy) {
+        /*
+         * If enable userspace proxy mode,
+         * we don't need teardown kernel proxy
+         */
+        return;
+    }
+
     if (cps->sock_fd >= 0) {
         close(cps->sock_fd);
         cps->sock_fd = -1;
@@ -232,6 +245,14 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps)
 
 void colo_proxy_preresume(libxl__colo_proxy_state *cps)
 {
+    if (cps->is_userspace_proxy) {
+        /*
+         * If enable userspace proxy mode,
+         * we don't need preresume kernel proxy
+         */
+        return;
+    }
+
     colo_proxy_send(cps, NULL, 0, COLO_CHECKPOINT);
     /* TODO: need to handle if the call fails... */
 }
@@ -260,6 +281,15 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
     struct colo_msg *m;
     int ret = -1;
 
+    /*
+     * enable userspace proxy mode, tmp sleep.
+     * then we will add qemu API support this func.
+     */
+    if (cps->is_userspace_proxy) {
+        sleep(timeout_us / 1000000);
+        return 0;
+    }
+
     STATE_AO_GC(cps->ao);
 
     size = colo_proxy_recv(cps, &buff, timeout_us);
diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c
index eb8336c..7b6e38f 100644
--- a/tools/libxl/libxl_colo_save.c
+++ b/tools/libxl/libxl_colo_save.c
@@ -110,8 +110,13 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css)
         css->colo_proxy_script = GCSPRINTF("%s/colo-proxy-setup",
                                            libxl__xen_script_dir_path());
 
-    cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) |
-                             (1 << LIBXL__DEVICE_KIND_VBD);
+    /* If enable userspace proxy mode, we don't need VIF */
+    if (css->cps.is_userspace_proxy) {
+        cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VBD);
+    } else {
+        cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) |
+                                 (1 << LIBXL__DEVICE_KIND_VBD);
+    }
     cds->ops = colo_ops;
     cds->callback = colo_save_setup_done;
     cds->ao = ao;
-- 
2.7.4




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-01-26  6:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26  6:36 [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Zhang Chen
2017-01-26  6:36 ` [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy Zhang Chen
2017-01-27 17:05   ` Wei Liu
2017-02-06  6:01     ` Zhang Chen
2017-01-26  6:36 ` Zhang Chen [this message]
2017-01-27 17:05   ` [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side Wei Liu
2017-02-06  6:32     ` Zhang Chen
2017-01-26  6:36 ` [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side Zhang Chen
2017-01-27 17:05   ` Wei Liu
2017-02-06  9:27     ` Zhang Chen
2017-02-06 11:25       ` Wei Liu
2017-02-07  1:39         ` Zhang Chen
2017-01-26  6:36 ` [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args Zhang Chen
2017-01-27 17:05   ` Wei Liu
2017-02-08  8:53     ` Zhang Chen
2017-01-26  6:36 ` [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy " Zhang Chen
2017-01-27 17:05   ` Wei Liu
2017-02-08  8:53     ` Zhang Chen
2017-01-26  6:36 ` [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event Zhang Chen
2017-01-27 17:05   ` Wei Liu
2017-02-08  8:54     ` Zhang Chen
2017-01-27 17:08 ` [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Wei Liu
2017-02-08  8:54   ` Zhang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485412569-7431-3-git-send-email-zhangchen.fnst@cn.fujitsu.com \
    --to=zhangchen.fnst@cn.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=biannm@cn.fujitsu.com \
    --cc=eddie.dong@intel.com \
    --cc=imhy.yang@gmail.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.