[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] COLO-Proxy: Setup userspace colo-proxy on primary side



commit 410cc81cfc773d0506cb1a263d04ae1841a2dcdc
Author:     Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
AuthorDate: Mon Mar 6 10:59:20 2017 +0800
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Mar 14 11:36:39 2017 +0000

    COLO-Proxy: Setup userspace colo-proxy on primary side
    
    In this patch we close kernel COLO-Proxy on primary side.
    
    Signed-off-by: Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl_colo_proxy.c | 31 +++++++++++++++++++++++++++++++
 tools/libxl/libxl_colo_save.c  |  9 +++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index 0983f42..ec76e37 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -152,6 +152,10 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)
 
     STATE_AO_GC(cps->ao);
 
+    /* If enable userspace proxy mode, we don't need setup kernel proxy */
+    if (cps->is_userspace_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 +226,13 @@ out:
 
 void colo_proxy_teardown(libxl__colo_proxy_state *cps)
 {
+    /*
+     * If enable userspace proxy mode,
+     * we don't need teardown kernel proxy
+     */
+    if (cps->is_userspace_proxy)
+        return;
+
     if (cps->sock_fd >= 0) {
         close(cps->sock_fd);
         cps->sock_fd = -1;
@@ -232,6 +243,13 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps)
 
 void colo_proxy_preresume(libxl__colo_proxy_state *cps)
 {
+    /*
+     * If enable userspace proxy mode,
+     * we don't need preresume kernel proxy
+     */
+    if (cps->is_userspace_proxy)
+        return;
+
     colo_proxy_send(cps, NULL, 0, COLO_CHECKPOINT);
     /* TODO: need to handle if the call fails... */
 }
@@ -262,6 +280,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
 
     STATE_AO_GC(cps->ao);
 
+    /*
+     * Enable userspace proxy to periodical checkpoint mode,
+     * sleeping temporarily for colo userspace proxy mode.
+     * then we will use socket recv instead of this usleep.
+     * In other words, we use socket communicate with Qemu
+     * Proxy part(colo-compare), for example, notify checkpoint
+     * event.
+     */
+    if (cps->is_userspace_proxy) {
+        usleep(timeout_us);
+        return 0;
+    }
+
     size = colo_proxy_recv(cps, &buff, timeout_us);
 
     /* timeout, return no checkpoint message. */
diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c
index eb8336c..91e3fce 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.