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

[Xen-devel] [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event.



We use old kernel colo proxy way to get the checkpoint event from qemu.
This patch have some TODO job.
Qemu compare need add a API to support this(I will add this in qemu).

Signed-off-by: Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
---
 tools/libxl/libxl_colo.h       |  2 ++
 tools/libxl/libxl_colo_proxy.c | 12 ++++++++++++
 tools/libxl/libxl_nic.c        |  8 ++++++++
 tools/libxl/libxl_types.idl    |  4 +++-
 tools/libxl/xl_cmdimpl.c       |  4 ++++
 5 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h
index 4746d8c..6c01b55 100644
--- a/tools/libxl/libxl_colo.h
+++ b/tools/libxl/libxl_colo.h
@@ -69,6 +69,8 @@ struct libxl__colo_proxy_state {
      *          False means use kernel colo proxy.
      */
     bool is_userspace_proxy;
+    const char *checkpoint_host;
+    const char *checkpoint_port;
 };
 
 struct libxl__colo_save_state {
diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index 348484d..a3c05f7 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -153,6 +153,11 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)
     STATE_AO_GC(cps->ao);
 
     if (cps->is_userspace_proxy) {
+        /*
+         * TODO: Get userspace colo proxy checkpoint socket fd.
+         * use cps->checkpoint_host and cps->checkpoint_host.
+         */
+
         /* If enable userspace proxy mode, we don't need setup kernel proxy */
         return 0;
     }
@@ -231,6 +236,8 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps)
         /*
          * If enable userspace proxy mode,
          * we don't need teardown kernel proxy
+         *
+         * TODO: close userspace colo proxy sock fd.
          */
         return;
     }
@@ -286,6 +293,11 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
      * then we will add qemu API support this func.
      */
     if (cps->is_userspace_proxy) {
+        /*
+         * TODO:
+         * colo_userspace_proxy_recv(cps, &buff, timeout_us);
+         * to get checkpoint event.
+         */
         sleep(timeout_us / 1000000);
         return 0;
     }
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 08e749f..fb5dfdb 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -646,6 +646,14 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
                                 GCSPRINTF("%s/filter_sec_rewriter0_queue", 
libxl_path),
                                 (const char 
**)(&nic->filter_sec_rewriter0_queue));
     if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/colo_checkpoint_host", 
libxl_path),
+                                (const char **)(&nic->colo_checkpoint_host));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/colo_checkpoint_port", 
libxl_path),
+                                (const char **)(&nic->colo_checkpoint_port));
+    if (rc) goto out;
 
     /* vif_ioemu nics use the same xenstore entries as vif interfaces */
     rc = libxl__xs_read_checked(gc, XBT_NULL,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 9063ca9..41e7d38 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -671,7 +671,9 @@ libxl_device_nic = Struct("device_nic", [
     ("filter_sec_redirector1_queue", string),
     ("filter_sec_redirector1_indev", string),
     ("filter_sec_redirector1_outdev", string),
-    ("filter_sec_rewriter0_queue", string)
+    ("filter_sec_rewriter0_queue", string),
+    ("colo_checkpoint_host", string),
+    ("colo_checkpoint_port", string)
     ])
 
 libxl_device_pci = Struct("device_pci", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index e587ab3..53ab561 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1144,6 +1144,10 @@ static int parse_nic_config(libxl_device_nic *nic, 
XLU_Config **config, char *to
         replace_string(&nic->filter_sec_redirector1_outdev, oparg);
     } else if (MATCH_OPTION("filter_sec_rewriter0_queue", token, oparg)) {
         replace_string(&nic->filter_sec_rewriter0_queue, oparg);
+    } else if (MATCH_OPTION("colo_checkpoint_host", token, oparg)) {
+        replace_string(&nic->colo_checkpoint_host, oparg);
+    } else if (MATCH_OPTION("colo_checkpoint_port", token, oparg)) {
+        replace_string(&nic->colo_checkpoint_port, oparg);
     } else if (MATCH_OPTION("accel", token, oparg)) {
         fprintf(stderr, "the accel parameter for vifs is currently not 
supported\n");
     } else {
-- 
2.7.4




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

 


Rackspace

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