All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy
@ 2017-01-26  6:36 Zhang Chen
  2017-01-26  6:36 ` [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy Zhang Chen
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

Hi~ All~ Happy Chinese New Year~~
Because of some reason, We no longer support COLO kernel proxy.
So we send this patch set to make Xen use userspace colo-proxy in qemu.

Below is a COLO userspace proxy ascii figure:

 Primary qemu                                                           Secondary qemu
+--------------------------------------------------------------+       +----------------------------------------------------------------+
| +----------------------------------------------------------+ |       |  +-----------------------------------------------------------+ |
| |                                                          | |       |  |                                                           | |
| |                        guest                             | |       |  |                        guest                              | |
| |                                                          | |       |  |                                                           | |
| +-------^--------------------------+-----------------------+ |       |  +---------------------+--------+----------------------------+ |
|         |                          |                         |       |                        ^        |                              |
|         |                          |                         |       |                        |        |                              |
|         |  +------------------------------------------------------+  |                        |        |                              |
|netfilter|  |                       |                         |    |  |   netfilter            |        |                              |
| +----------+ +----------------------------+                  |    |  |  +-----------------------------------------------------------+ |
| |       |  |                       |      |        out       |    |  |  |                     |        |  filter excute order       | |
| |       |  |          +-----------------------------+        |    |  |  |                     |        | +------------------->      | |
| |       |  |          |            |      |         |        |    |  |  |                     |        |   TCP                      | |
| | +-----+--+-+  +-----v----+ +-----v----+ |pri +----+----+sec|    |  |  | +------------+  +---+----+---v+rewriter++  +------------+ | |
| | |          |  |          | |          | |in  |         |in |    |  |  | |            |  |        |              |  |            | | |
| | |  filter  |  |  filter  | |  filter  +------>  colo   <------+ +-------->  filter   +--> adjust |   adjust     +-->   filter   | | |
| | |  mirror  |  |redirector| |redirector| |    | compare |   |  |    |  | | redirector |  | ack    |   seq        |  | redirector | | |
| | |          |  |          | |          | |    |         |   |  |    |  | |            |  |        |              |  |            | | |
| | +----^-----+  +----+-----+ +----------+ |    +---------+   |  |    |  | +------------+  +--------+--------------+  +---+--------+ | |
| |      |   tx        |   rx           rx  |                  |  |    |  |            tx                        all       |  rx      | |
| |      |             |                    |                  |  |    |  +-----------------------------------------------------------+ |
| |      |             +--------------+     |                  |  |    |                                                   |            |
| |      |   filter excute order      |     |                  |  |    |                                                   |            |
| |      |  +---------------->        |     |                  |  +--------------------------------------------------------+            |
| +-----------------------------------------+                  |       |                                                                |
|        |                            |                        |       |                                                                |
+--------------------------------------------------------------+       +----------------------------------------------------------------+
         |guest receive               | guest send
         |                            |
+--------+----------------------------v------------------------+
|                                                              |                          NOTE: filter direction is rx/tx/all
|                         tap                                  |                          rx:receive packets sent to the netdev
|                                                              |                          tx:receive packets sent by the netdev
+--------------------------------------------------------------+

You can know the detail from here:

http://wiki.qemu.org/Features/COLO
https://github.com/qemu/qemu/blob/master/docs/colo-proxy.txt



Zhang Chen (6):
  COLO-Proxy: Add remus command to open userspace proxy
  COLO-Proxy: Setup userspace colo-proxy on primary side
  COLO-Proxy: Setup userspace colo-proxy on secondary side
  COLO-Proxy: Add primary userspace colo proxy start args
  COLO-Proxy: Add secondary userspace colo-proxy start args
  COLO-Proxy: Use socket to get checkpoint event.

 docs/man/xl.pod.1.in             |   4 +
 tools/libxl/libxl_colo.h         |   7 +
 tools/libxl/libxl_colo_proxy.c   |  42 ++++++
 tools/libxl/libxl_colo_restore.c |   9 +-
 tools/libxl/libxl_colo_save.c    |  11 +-
 tools/libxl/libxl_create.c       |   9 +-
 tools/libxl/libxl_dm.c           | 149 +++++++++++++++++++
 tools/libxl/libxl_nic.c          | 306 +++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl      |  64 ++++++--
 tools/libxl/xl_cmdimpl.c         | 119 ++++++++++++++-
 tools/libxl/xl_cmdtable.c        |   3 +-
 11 files changed, 703 insertions(+), 20 deletions(-)

-- 
2.7.4




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy
  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 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-26  6:36 ` [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side Zhang Chen
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

Add remus '-p' to enable userspace colo proxy(in qemu).

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 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<pause> I<domain-id>
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",
-- 
2.7.4




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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side
  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-26  6:36 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-26  6:36 ` [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side Zhang Chen
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side
  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-26  6:36 ` [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side Zhang Chen
@ 2017-01-26  6:36 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-26  6:36 ` [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args Zhang Chen
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

In this patch we add a function to close
kernel COLO-Proxy on secondary side.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 tools/libxl/libxl_colo_restore.c |  9 +++++++--
 tools/libxl/libxl_create.c       |  9 +++++++--
 tools/libxl/libxl_types.idl      |  1 +
 tools/libxl/xl_cmdimpl.c         | 18 +++++++++++++++---
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c
index 6a96328..1d42539 100644
--- a/tools/libxl/libxl_colo_restore.c
+++ b/tools/libxl/libxl_colo_restore.c
@@ -774,8 +774,13 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc,
 
     STATE_AO_GC(crs->ao);
 
-    cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) |
-                             (1 << LIBXL__DEVICE_KIND_VBD);
+    if (crs->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->callback = colo_restore_setup_cds_done;
     cds->ao = ao;
     cds->domid = crs->domid;
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index e3bc257..d230ecd 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1609,6 +1609,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
                             uint32_t *domid, int restore_fd, int send_back_fd,
                             const libxl_domain_restore_params *params,
                             const char *colo_proxy_script,
+                            const bool userspace_colo_proxy,
                             const libxl_asyncop_how *ao_how,
                             const libxl_asyncprogress_how *aop_console_how)
 {
@@ -1633,6 +1634,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
     cdcs->dcs.callback = domain_create_cb;
     cdcs->dcs.domid_soft_reset = INVALID_DOMID;
     cdcs->dcs.colo_proxy_script = colo_proxy_script;
+    cdcs->dcs.crs.cps.is_userspace_proxy = userspace_colo_proxy;
     libxl__ao_progress_gethow(&cdcs->dcs.aop_console_how, aop_console_how);
     cdcs->domid_out = domid;
 
@@ -1821,7 +1823,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
 {
     unset_disk_colo_restore(d_config);
     return do_domain_create(ctx, d_config, domid, -1, -1, NULL, NULL,
-                            ao_how, aop_console_how);
+                            false, ao_how, aop_console_how);
 }
 
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
@@ -1832,16 +1834,19 @@ int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
                                 const libxl_asyncprogress_how *aop_console_how)
 {
     char *colo_proxy_script = NULL;
+    bool userspace_colo_proxy = false;
 
     if (params->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_COLO) {
         colo_proxy_script = params->colo_proxy_script;
+        userspace_colo_proxy = libxl_defbool_val(params->userspace_colo_proxy);
         set_disk_colo_restore(d_config);
     } else {
         unset_disk_colo_restore(d_config);
     }
 
     return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
-                            params, colo_proxy_script, ao_how, aop_console_how);
+                            params, colo_proxy_script, userspace_colo_proxy,
+                            ao_how, aop_console_how);
 }
 
 int libxl_domain_soft_reset(libxl_ctx *ctx,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 1bd2057..89c2c9d 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -390,6 +390,7 @@ libxl_domain_restore_params = Struct("domain_restore_params", [
     ("checkpointed_stream", integer),
     ("stream_version", uint32, {'init_val': '1'}),
     ("colo_proxy_script", string),
+    ("userspace_colo_proxy", libxl_defbool),
     ])
 
 libxl_sched_params = Struct("sched_params",[
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 905c5f6..1620bd7 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -162,6 +162,7 @@ struct domain_create {
     char *extra_config; /* extra config string */
     const char *restore_file;
     char *colo_proxy_script;
+    bool userspace_colo_proxy;
     int migrate_fd; /* -1 means none */
     int send_back_fd; /* -1 means none */
     char **migration_domname_r; /* from malloc */
@@ -3024,6 +3025,8 @@ start:
         params.stream_version =
             (hdr.mandatory_flags & XL_MANDATORY_FLAG_STREAMv2) ? 2 : 1;
         params.colo_proxy_script = dom_info->colo_proxy_script;
+        libxl_defbool_set(&params.userspace_colo_proxy,
+                          dom_info->userspace_colo_proxy);
 
         ret = libxl_domain_create_restore(ctx, &d_config,
                                           &domid, restore_fd,
@@ -4824,7 +4827,8 @@ static void migrate_receive(int debug, int daemonize, int monitor,
                             int pause_after_migration,
                             int send_fd, int recv_fd,
                             libxl_checkpointed_stream checkpointed,
-                            char *colo_proxy_script)
+                            char *colo_proxy_script,
+                            bool userspace_colo_proxy)
 {
     uint32_t domid;
     int rc, rc2;
@@ -4852,6 +4856,7 @@ static void migrate_receive(int debug, int daemonize, int monitor,
     dom_info.migration_domname_r = &migration_domname;
     dom_info.checkpointed_stream = checkpointed;
     dom_info.colo_proxy_script = colo_proxy_script;
+    dom_info.userspace_colo_proxy = userspace_colo_proxy;
 
     rc = create_domain(&dom_info);
     if (rc < 0) {
@@ -5051,11 +5056,13 @@ int main_migrate_receive(int argc, char **argv)
     int debug = 0, daemonize = 1, monitor = 1, pause_after_migration = 0;
     libxl_checkpointed_stream checkpointed = LIBXL_CHECKPOINTED_STREAM_NONE;
     int opt;
+    bool userspace_colo_proxy = false;
     char *script = NULL;
     static struct option opts[] = {
         {"colo", 0, 0, 0x100},
         /* It is a shame that the management code for disk is not here. */
         {"coloft-script", 1, 0, 0x200},
+        {"userspace-colo-proxy", 0, 0, 0x300},
         COMMON_LONG_OPTS
     };
 
@@ -5079,6 +5086,9 @@ int main_migrate_receive(int argc, char **argv)
     case 0x200:
         script = optarg;
         break;
+    case 0x300:
+        userspace_colo_proxy = true;
+        break;
     case 'p':
         pause_after_migration = 1;
         break;
@@ -5090,7 +5100,7 @@ int main_migrate_receive(int argc, char **argv)
     }
     migrate_receive(debug, daemonize, monitor, pause_after_migration,
                     STDOUT_FILENO, STDIN_FILENO,
-                    checkpointed, script);
+                    checkpointed, script, userspace_colo_proxy);
 
     return EXIT_SUCCESS;
 }
@@ -8984,11 +8994,13 @@ int main_remus(int argc, char **argv)
                           "-r",
                           daemonize ? "" : " -e");
             } else {
-                xasprintf(&rune, "exec %s %s xl migrate-receive %s %s %s %s",
+                xasprintf(&rune, "exec %s %s xl migrate-receive %s %s %s %s %s",
                           ssh_command, host,
                           "--colo",
                           r_info.netbufscript ? "--coloft-script" : "",
                           r_info.netbufscript ? r_info.netbufscript : "",
+                          libxl_defbool_val(r_info.userspace_colo_proxy) ?
+                          "--userspace-colo-proxy" : "",
                           daemonize ? "" : " -e");
             }
         }
-- 
2.7.4




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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args
  2017-01-26  6:36 [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Zhang Chen
                   ` (2 preceding siblings ...)
  2017-01-26  6:36 ` [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side Zhang Chen
@ 2017-01-26  6:36 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-26  6:36 ` [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy " Zhang Chen
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

Qemu need this args to start userspace colo-proxy.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 tools/libxl/libxl_dm.c      | 104 ++++++++++++++++++++
 tools/libxl/libxl_nic.c     | 232 ++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl |  31 +++++-
 tools/libxl/xl_cmdimpl.c    |  58 +++++++++++
 4 files changed, 424 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 281058d..b3484df 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1244,6 +1244,110 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                                            nics[i].devid, ifname,
                                            libxl_tapif_script(gc),
                                            libxl_tapif_script(gc)));
+
+                /* Userspace COLO Proxy need this */
+                if (state->saved_state) {
+                    /* secondary colo run */
+                } else {
+                    /* primary colo run */
+                    if (nics[i].sock_mirror_id &&
+                        nics[i].sock_mirror_ip &&
+                        nics[i].sock_mirror_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,server,nowait",
+                                     nics[i].sock_mirror_id,
+                                     nics[i].sock_mirror_ip,
+                                     nics[i].sock_mirror_port));
+                    }
+                    if (nics[i].sock_compare_pri_in_id &&
+                        nics[i].sock_compare_pri_in_ip &&
+                        nics[i].sock_compare_pri_in_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,server,nowait",
+                                     nics[i].sock_compare_pri_in_id,
+                                     nics[i].sock_compare_pri_in_ip,
+                                     nics[i].sock_compare_pri_in_port));
+                    }
+                    if (nics[i].sock_compare_sec_in_id &&
+                        nics[i].sock_compare_sec_in_ip &&
+                        nics[i].sock_compare_sec_in_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,server,nowait",
+                                     nics[i].sock_compare_sec_in_id,
+                                     nics[i].sock_compare_sec_in_ip,
+                                     nics[i].sock_compare_sec_in_port));
+                    }
+                    if (nics[i].sock_redirector0_id &&
+                        nics[i].sock_redirector0_ip &&
+                        nics[i].sock_redirector0_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,server,nowait",
+                                     nics[i].sock_redirector0_id,
+                                     nics[i].sock_redirector0_ip,
+                                     nics[i].sock_redirector0_port));
+                    }
+                    if (nics[i].sock_redirector1_id &&
+                        nics[i].sock_redirector1_ip &&
+                        nics[i].sock_redirector1_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s",
+                                     nics[i].sock_redirector1_id,
+                                     nics[i].sock_redirector1_ip,
+                                     nics[i].sock_redirector1_port));
+                    }
+                    if (nics[i].sock_redirector2_id &&
+                        nics[i].sock_redirector2_ip &&
+                        nics[i].sock_redirector2_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s",
+                                     nics[i].sock_redirector2_id,
+                                     nics[i].sock_redirector2_ip,
+                                     nics[i].sock_redirector2_port));
+                    }
+                    if (nics[i].filter_mirror_queue &&
+                        nics[i].filter_mirror_outdev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("filter-mirror,id=m1,netdev=net%d,queue=%s,outdev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_mirror_queue,
+                                     nics[i].filter_mirror_outdev));
+                    }
+                    if (nics[i].filter_redirector0_queue &&
+                        nics[i].filter_redirector0_indev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("filter-redirector,id=r1,netdev=net%d,queue=%s,indev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_redirector0_queue,
+                                     nics[i].filter_redirector0_indev));
+                    }
+                    if (nics[i].filter_redirector1_queue &&
+                        nics[i].filter_redirector1_outdev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                          GCSPRINTF("filter-redirector,id=r2,netdev=net%d,queue=%s,outdev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_redirector1_queue,
+                                     nics[i].filter_redirector1_outdev));
+                    }
+                    if (nics[i].colo_compare_pri_in &&
+                        nics[i].colo_compare_sec_in &&
+                        nics[i].colo_compare_out) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s",
+                                     nics[i].colo_compare_pri_in,
+                                     nics[i].colo_compare_sec_in,
+                                     nics[i].colo_compare_out));
+                    }
+                }
                 ioemu_nics++;
             }
         }
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 61b55ca..b7a3596 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -196,6 +196,123 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(back, nic->coloft_forwarddev);
     }
 
+    if (nic->sock_mirror_id) {
+        flexarray_append(back, "sock_mirror_id");
+        flexarray_append(back, nic->sock_mirror_id);
+    }
+    if (nic->sock_mirror_ip) {
+        flexarray_append(back, "sock_mirror_ip");
+        flexarray_append(back, nic->sock_mirror_ip);
+    }
+    if (nic->sock_mirror_port) {
+        flexarray_append(back, "sock_mirror_port");
+        flexarray_append(back, nic->sock_mirror_port);
+    }
+    if (nic->sock_compare_pri_in_id) {
+        flexarray_append(back, "sock_compare_pri_in_id");
+        flexarray_append(back, nic->sock_compare_pri_in_id);
+    }
+    if (nic->sock_compare_pri_in_ip) {
+        flexarray_append(back, "sock_compare_pri_in_ip");
+        flexarray_append(back, nic->sock_compare_pri_in_ip);
+    }
+    if (nic->sock_compare_pri_in_port) {
+        flexarray_append(back, "sock_compare_pri_in_port");
+        flexarray_append(back, nic->sock_compare_pri_in_port);
+    }
+    if (nic->sock_compare_sec_in_id) {
+        flexarray_append(back, "sock_compare_sec_in_id");
+        flexarray_append(back, nic->sock_compare_sec_in_id);
+    }
+    if (nic->sock_compare_sec_in_ip) {
+        flexarray_append(back, "sock_compare_sec_in_ip");
+        flexarray_append(back, nic->sock_compare_sec_in_ip);
+    }
+    if (nic->sock_compare_sec_in_port) {
+        flexarray_append(back, "sock_compare_sec_in_port");
+        flexarray_append(back, nic->sock_compare_sec_in_port);
+    }
+    if (nic->sock_redirector0_id) {
+        flexarray_append(back, "sock_redirector0_id");
+        flexarray_append(back, nic->sock_redirector0_id);
+    }
+    if (nic->sock_redirector0_ip) {
+        flexarray_append(back, "sock_redirector0_ip");
+        flexarray_append(back, nic->sock_redirector0_ip);
+    }
+    if (nic->sock_redirector0_port) {
+        flexarray_append(back, "sock_redirector0_port");
+        flexarray_append(back, nic->sock_redirector0_port);
+    }
+    if (nic->sock_redirector1_id) {
+        flexarray_append(back, "sock_redirector1_id");
+        flexarray_append(back, nic->sock_redirector1_id);
+    }
+    if (nic->sock_redirector1_ip) {
+        flexarray_append(back, "sock_redirector1_ip");
+        flexarray_append(back, nic->sock_redirector1_ip);
+    }
+    if (nic->sock_redirector1_port) {
+        flexarray_append(back, "sock_redirector1_port");
+        flexarray_append(back, nic->sock_redirector1_port);
+    }
+    if (nic->sock_redirector2_id) {
+        flexarray_append(back, "sock_redirector2_id");
+        flexarray_append(back, nic->sock_redirector2_id);
+    }
+    if (nic->sock_redirector2_ip) {
+        flexarray_append(back, "sock_redirector2_ip");
+        flexarray_append(back, nic->sock_redirector2_ip);
+    }
+    if (nic->sock_redirector2_port) {
+        flexarray_append(back, "sock_redirector2_port");
+        flexarray_append(back, nic->sock_redirector2_port);
+    }
+    if (nic->filter_mirror_queue) {
+        flexarray_append(back, "filter_mirror_queue");
+        flexarray_append(back, nic->filter_mirror_queue);
+    }
+    if (nic->filter_mirror_outdev) {
+        flexarray_append(back, "filter_mirror_outdev");
+        flexarray_append(back, nic->filter_mirror_outdev);
+    }
+    if (nic->filter_redirector0_queue) {
+        flexarray_append(back, "filter_redirector0_queue");
+        flexarray_append(back, nic->filter_redirector0_queue);
+    }
+    if (nic->filter_redirector0_indev) {
+        flexarray_append(back, "filter_redirector0_indev");
+        flexarray_append(back, nic->filter_redirector0_indev);
+    }
+    if (nic->filter_redirector0_outdev) {
+        flexarray_append(back, "filter_redirector0_outdev");
+        flexarray_append(back, nic->filter_redirector0_outdev);
+    }
+    if (nic->filter_redirector1_queue) {
+        flexarray_append(back, "filter_redirector1_queue");
+        flexarray_append(back, nic->filter_redirector1_queue);
+    }
+    if (nic->filter_redirector1_indev) {
+        flexarray_append(back, "filter_redirector1_indev");
+        flexarray_append(back, nic->filter_redirector1_indev);
+    }
+    if (nic->filter_redirector1_outdev) {
+        flexarray_append(back, "filter_redirector1_outdev");
+        flexarray_append(back, nic->filter_redirector1_outdev);
+    }
+    if (nic->colo_compare_pri_in) {
+        flexarray_append(back, "colo_compare_pri_in");
+        flexarray_append(back, nic->colo_compare_pri_in);
+    }
+    if (nic->colo_compare_sec_in) {
+        flexarray_append(back, "colo_compare_sec_in");
+        flexarray_append(back, nic->colo_compare_sec_in);
+    }
+    if (nic->colo_compare_out) {
+        flexarray_append(back, "colo_compare_out");
+        flexarray_append(back, nic->colo_compare_out);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
     if (nic->ip) {
@@ -348,6 +465,121 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
                                 GCSPRINTF("%s/forwarddev", libxl_path),
                                 (const char **)(&nic->coloft_forwarddev));
     if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_mirror_id", libxl_path),
+                                (const char **)(&nic->sock_mirror_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_mirror_ip", libxl_path),
+                                (const char **)(&nic->sock_mirror_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_mirror_port", libxl_path),
+                                (const char **)(&nic->sock_mirror_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_pri_in_id", libxl_path),
+                                (const char **)(&nic->sock_compare_pri_in_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_pri_in_ip", libxl_path),
+                                (const char **)(&nic->sock_compare_pri_in_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_pri_in_port", libxl_path),
+                                (const char **)(&nic->sock_compare_pri_in_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_sec_in_id", libxl_path),
+                                (const char **)(&nic->sock_compare_sec_in_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_sec_in_ip", libxl_path),
+                                (const char **)(&nic->sock_compare_sec_in_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_compare_sec_in_port", libxl_path),
+                                (const char **)(&nic->sock_compare_sec_in_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector0_id", libxl_path),
+                                (const char **)(&nic->sock_redirector0_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector0_ip", libxl_path),
+                                (const char **)(&nic->sock_redirector0_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector0_port", libxl_path),
+                                (const char **)(&nic->sock_redirector0_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector1_id", libxl_path),
+                                (const char **)(&nic->sock_redirector1_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector1_ip", libxl_path),
+                                (const char **)(&nic->sock_redirector1_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector1_port", libxl_path),
+                                (const char **)(&nic->sock_redirector1_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector2_id", libxl_path),
+                                (const char **)(&nic->sock_redirector2_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector2_ip", libxl_path),
+                                (const char **)(&nic->sock_redirector2_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_redirector2_port", libxl_path),
+                                (const char **)(&nic->sock_redirector2_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_mirror_queue", libxl_path),
+                                (const char **)(&nic->filter_mirror_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_mirror_outdev", libxl_path),
+                                (const char **)(&nic->filter_mirror_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector0_queue", libxl_path),
+                                (const char **)(&nic->filter_redirector0_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector0_indev", libxl_path),
+                                (const char **)(&nic->filter_redirector0_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector0_outdev", libxl_path),
+                                (const char **)(&nic->filter_redirector0_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector1_queue", libxl_path),
+                                (const char **)(&nic->filter_redirector1_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector1_indev", libxl_path),
+                                (const char **)(&nic->filter_redirector1_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_redirector1_outdev", libxl_path),
+                                (const char **)(&nic->filter_redirector1_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/colo_compare_pri_in", libxl_path),
+                                (const char **)(&nic->colo_compare_pri_in));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/colo_compare_sec_in", libxl_path),
+                                (const char **)(&nic->colo_compare_sec_in));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/colo_compare_out", libxl_path),
+                                (const char **)(&nic->colo_compare_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 89c2c9d..1deb11b 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -629,7 +629,36 @@ libxl_device_nic = Struct("device_nic", [
     ("gatewaydev", string),
     # Note that the COLO configuration settings should be considered unstable.
     # They may change incompatibly in future versions of Xen.
-    ("coloft_forwarddev", string)
+    ("coloft_forwarddev", string),
+    ("sock_mirror_id", string),
+    ("sock_mirror_ip", string),
+    ("sock_mirror_port", string),
+    ("sock_compare_pri_in_id", string),
+    ("sock_compare_pri_in_ip", string),
+    ("sock_compare_pri_in_port", string),
+    ("sock_compare_sec_in_id", string),
+    ("sock_compare_sec_in_ip", string),
+    ("sock_compare_sec_in_port", string),
+    ("sock_redirector0_id", string),
+    ("sock_redirector0_ip", string),
+    ("sock_redirector0_port", string),
+    ("sock_redirector1_id", string),
+    ("sock_redirector1_ip", string),
+    ("sock_redirector1_port", string),
+    ("sock_redirector2_id", string),
+    ("sock_redirector2_ip", string),
+    ("sock_redirector2_port", string),
+    ("filter_mirror_queue", string),
+    ("filter_mirror_outdev", string),
+    ("filter_redirector0_queue", string),
+    ("filter_redirector0_indev", string),
+    ("filter_redirector0_outdev", string),
+    ("filter_redirector1_queue", string),
+    ("filter_redirector1_indev", string),
+    ("filter_redirector1_outdev", string),
+    ("colo_compare_pri_in", string),
+    ("colo_compare_sec_in", string),
+    ("colo_compare_out", string)
     ])
 
 libxl_device_pci = Struct("device_pci", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 1620bd7..996316e 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1060,6 +1060,64 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to
         parse_vif_rate(config, oparg, nic);
     } else if (MATCH_OPTION("forwarddev", token, oparg)) {
         replace_string(&nic->coloft_forwarddev, oparg);
+    } else if (MATCH_OPTION("sock_mirror_id", token, oparg)) {
+        replace_string(&nic->sock_mirror_id, oparg);
+    } else if (MATCH_OPTION("sock_mirror_ip", token, oparg)) {
+        replace_string(&nic->sock_mirror_ip, oparg);
+    } else if (MATCH_OPTION("sock_mirror_port", token, oparg)) {
+        replace_string(&nic->sock_mirror_port, oparg);
+    } else if (MATCH_OPTION("sock_compare_sec_in_id", token, oparg)) {
+        replace_string(&nic->sock_compare_sec_in_id, oparg);
+    } else if (MATCH_OPTION("sock_compare_sec_in_ip", token, oparg)) {
+        replace_string(&nic->sock_compare_sec_in_ip, oparg);
+    } else if (MATCH_OPTION("sock_compare_sec_in_port", token, oparg)) {
+        replace_string(&nic->sock_compare_sec_in_port, oparg);
+    } else if (MATCH_OPTION("sock_redirector0_id", token, oparg)) {
+        replace_string(&nic->sock_redirector0_id, oparg);
+    } else if (MATCH_OPTION("sock_redirector0_ip", token, oparg)) {
+        replace_string(&nic->sock_redirector0_ip, oparg);
+    } else if (MATCH_OPTION("sock_redirector0_port", token, oparg)) {
+        replace_string(&nic->sock_redirector0_port, oparg);
+    } else if (MATCH_OPTION("sock_redirector1_id", token, oparg)) {
+        replace_string(&nic->sock_redirector1_id, oparg);
+    } else if (MATCH_OPTION("sock_redirector1_ip", token, oparg)) {
+        replace_string(&nic->sock_redirector1_ip, oparg);
+    } else if (MATCH_OPTION("sock_redirector1_port", token, oparg)) {
+        replace_string(&nic->sock_redirector1_port, oparg);
+    } else if (MATCH_OPTION("sock_redirector2_id", token, oparg)) {
+        replace_string(&nic->sock_redirector2_id, oparg);
+    } else if (MATCH_OPTION("sock_redirector2_ip", token, oparg)) {
+        replace_string(&nic->sock_redirector2_ip, oparg);
+    } else if (MATCH_OPTION("sock_redirector2_port", token, oparg)) {
+        replace_string(&nic->sock_redirector2_port, oparg);
+    } else if (MATCH_OPTION("sock_compare_pri_in_id", token, oparg)) {
+        replace_string(&nic->sock_compare_pri_in_id, oparg);
+    } else if (MATCH_OPTION("sock_compare_pri_in_ip", token, oparg)) {
+        replace_string(&nic->sock_compare_pri_in_ip, oparg);
+    } else if (MATCH_OPTION("sock_compare_pri_in_port", token, oparg)) {
+        replace_string(&nic->sock_compare_pri_in_port, oparg);
+    } else if (MATCH_OPTION("filter_mirror_queue", token, oparg)) {
+        replace_string(&nic->filter_mirror_queue, oparg);
+    } else if (MATCH_OPTION("filter_mirror_outdev", token, oparg)) {
+        replace_string(&nic->filter_mirror_outdev, oparg);
+    } else if (MATCH_OPTION("filter_redirector0_queue", token, oparg)) {
+        replace_string(&nic->filter_redirector0_queue, oparg);
+    } else if (MATCH_OPTION("filter_redirector0_indev", token, oparg)) {
+        replace_string(&nic->filter_redirector0_indev, oparg);
+    } else if (MATCH_OPTION("filter_redirector0_outdev", token, oparg)) {
+        replace_string(&nic->filter_redirector0_outdev, oparg);
+    } else if (MATCH_OPTION("filter_redirector1_queue", token, oparg)) {
+        replace_string(&nic->filter_redirector1_queue, oparg);
+    } else if (MATCH_OPTION("filter_redirector1_indev", token, oparg)) {
+        replace_string(&nic->filter_redirector1_indev, oparg);
+    } else if (MATCH_OPTION("filter_redirector1_outdev", token, oparg)) {
+        replace_string(&nic->filter_redirector1_outdev, oparg);
+    } else if (MATCH_OPTION("colo_compare_pri_in", token, oparg)) {
+        replace_string(&nic->colo_compare_pri_in, oparg);
+    } else if (MATCH_OPTION("colo_compare_sec_in", token, oparg)) {
+        replace_string(&nic->colo_compare_sec_in, oparg);
+    } else if (MATCH_OPTION("colo_compare_out", token, oparg)) {
+        replace_string(&nic->colo_compare_out, 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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy start args
  2017-01-26  6:36 [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Zhang Chen
                   ` (3 preceding siblings ...)
  2017-01-26  6:36 ` [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args Zhang Chen
@ 2017-01-26  6:36 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-26  6:36 ` [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event Zhang Chen
  2017-01-27 17:08 ` [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Wei Liu
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

Qemu need this args to start userspace colo-proxy.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 tools/libxl/libxl_dm.c      | 45 +++++++++++++++++++++++++++++++
 tools/libxl/libxl_nic.c     | 66 +++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl | 15 ++++++++++-
 tools/libxl/xl_cmdimpl.c    | 26 ++++++++++++++++++
 4 files changed, 151 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index b3484df..3641044 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1248,6 +1248,51 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 /* Userspace COLO Proxy need this */
                 if (state->saved_state) {
                     /* secondary colo run */
+                    if (nics[i].sock_sec_redirector0_id &&
+                        nics[i].sock_sec_redirector0_ip &&
+                        nics[i].sock_sec_redirector0_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,reconnect=1",
+                                     nics[i].sock_sec_redirector0_id,
+                                     nics[i].sock_sec_redirector0_ip,
+                                     nics[i].sock_sec_redirector0_port));
+                    }
+                    if (nics[i].sock_sec_redirector1_id &&
+                        nics[i].sock_sec_redirector1_ip &&
+                        nics[i].sock_sec_redirector1_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("socket,id=%s,host=%s,port=%s,reconnect=1",
+                                     nics[i].sock_sec_redirector1_id,
+                                     nics[i].sock_sec_redirector1_ip,
+                                     nics[i].sock_sec_redirector1_port));
+                    }
+                    if (nics[i].filter_sec_redirector0_queue &&
+                        nics[i].filter_sec_redirector0_indev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("filter-redirector,id=rs1,netdev=net%d,queue=%s,indev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_redirector0_queue,
+                                     nics[i].filter_sec_redirector0_indev));
+                    }
+                    if (nics[i].filter_sec_redirector1_queue &&
+                        nics[i].filter_sec_redirector1_indev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("filter-redirector,id=rs2,netdev=net%d,queue=%s,outdev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_redirector1_queue,
+                                     nics[i].filter_sec_redirector1_outdev));
+                    }
+                    if (nics[i].filter_sec_rewriter0_queue) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("filter-rewriter,id=rs3,netdev=net%d,queue=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_rewriter0_queue));
+                    }
                 } else {
                     /* primary colo run */
                     if (nics[i].sock_mirror_id &&
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index b7a3596..08e749f 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -313,6 +313,19 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(back, nic->colo_compare_out);
     }
 
+    if (nic->sock_sec_redirector0_id) {
+        flexarray_append(back, "sock_redirector0_id");
+        flexarray_append(back, nic->sock_redirector0_id);
+    }
+    if (nic->sock_sec_redirector0_ip) {
+        flexarray_append(back, "sock_redirector0_ip");
+        flexarray_append(back, nic->sock_redirector0_ip);
+    }
+    if (nic->sock_sec_redirector0_port) {
+        flexarray_append(back, "sock_redirector0_port");
+        flexarray_append(back, nic->sock_redirector0_port);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
     if (nic->ip) {
@@ -580,6 +593,59 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
     rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/colo_compare_out", libxl_path),
                                 (const char **)(&nic->colo_compare_out));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_id", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_ip", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_port", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_id", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_ip", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_port", libxl_path),
+                                (const char **)(&nic->sock_sec_redirector0_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_queue", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector0_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_indev", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector0_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_outdev", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector0_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_queue", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector1_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_indev", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector1_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_outdev", libxl_path),
+                                (const char **)(&nic->filter_sec_redirector1_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_rewriter0_queue", libxl_path),
+                                (const char **)(&nic->filter_sec_rewriter0_queue));
+    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 1deb11b..9063ca9 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -658,7 +658,20 @@ libxl_device_nic = Struct("device_nic", [
     ("filter_redirector1_outdev", string),
     ("colo_compare_pri_in", string),
     ("colo_compare_sec_in", string),
-    ("colo_compare_out", string)
+    ("colo_compare_out", string),
+    ("sock_sec_redirector0_id", string),
+    ("sock_sec_redirector0_ip", string),
+    ("sock_sec_redirector0_port", string),
+    ("sock_sec_redirector1_id", string),
+    ("sock_sec_redirector1_ip", string),
+    ("sock_sec_redirector1_port", string),
+    ("filter_sec_redirector0_queue", string),
+    ("filter_sec_redirector0_indev", string),
+    ("filter_sec_redirector0_outdev", string),
+    ("filter_sec_redirector1_queue", string),
+    ("filter_sec_redirector1_indev", string),
+    ("filter_sec_redirector1_outdev", string),
+    ("filter_sec_rewriter0_queue", string)
     ])
 
 libxl_device_pci = Struct("device_pci", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 996316e..e587ab3 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1118,6 +1118,32 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to
         replace_string(&nic->colo_compare_sec_in, oparg);
     } else if (MATCH_OPTION("colo_compare_out", token, oparg)) {
         replace_string(&nic->colo_compare_out, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_id", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_id, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_ip", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_ip, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_port", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_port, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_id", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_id, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_ip", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_ip, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_port", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_port, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_queue", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_queue, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_indev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_indev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_outdev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_outdev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_queue", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector1_queue, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_indev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector1_indev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_outdev", token, oparg)) {
+        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("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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event.
  2017-01-26  6:36 [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Zhang Chen
                   ` (4 preceding siblings ...)
  2017-01-26  6:36 ` [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy " Zhang Chen
@ 2017-01-26  6:36 ` Zhang Chen
  2017-01-27 17:05   ` Wei Liu
  2017-01-27 17:08 ` [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Wei Liu
  6 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-01-26  6:36 UTC (permalink / raw)
  To: Xen devel, Ian Jackson, Wei Liu
  Cc: eddie . dong, Yang Hongyang, Bian Naimeng, Li Zhijian, Zhang Chen

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@cn.fujitsu.com>
---
 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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:04PM +0800, Zhang Chen wrote:
> Add remus '-p' to enable userspace colo proxy(in qemu).
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
>  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>.
> +

Use userspace COLO Proxy. This option must be used in conjunction with B<-c>.

>  =back
>  
>  =item B<pause> I<domain-id>
> 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)

Please add a LIBXL_HAVE macro in libxl.h.

>      ])
>  
>  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);
> +

Hmm... I think setting defaults should be pushed into libxl.

But I think this is issue is orthogonal to this patch, and we can
revisit this later.

>      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");

"Option -p must be used in conjunction with -c".

And please use fprintf(stderr,...) here because libxl_defbool_val
doesn't touch errno.


> +        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."

"Use".

Wei.

>      },
>  #endif
>      { "devd",
> -- 
> 2.7.4
> 
> 
> 

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side
  2017-01-26  6:36 ` [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side Zhang Chen
@ 2017-01-27 17:05   ` Wei Liu
  2017-02-06  6:32     ` Zhang Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:05PM +0800, Zhang Chen wrote:
> In this patch we close kernel COLO-Proxy on primary side.
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

I don't claim I know much about COLO though, nor have I ever run it, so
it would be better to have a second eye on this patch.

There are some style nits below.

> ---
>  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;
> +    }
> +

There is only one statement so no need to have {}.

You can move the comment before "if" and remove {}.

Same rule applies to all the patches.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:06PM +0800, Zhang Chen wrote:
> In this patch we add a function to close
> kernel COLO-Proxy on secondary side.
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
>  tools/libxl/libxl_colo_restore.c |  9 +++++++--
>  tools/libxl/libxl_create.c       |  9 +++++++--
>  tools/libxl/libxl_types.idl      |  1 +
>  tools/libxl/xl_cmdimpl.c         | 18 +++++++++++++++---
>  4 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c
> index 6a96328..1d42539 100644
> --- a/tools/libxl/libxl_colo_restore.c
> +++ b/tools/libxl/libxl_colo_restore.c
> @@ -774,8 +774,13 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc,
>  
>      STATE_AO_GC(crs->ao);
>  
> -    cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) |
> -                             (1 << LIBXL__DEVICE_KIND_VBD);
> +    if (crs->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);
> +    }
> +

Style issue.

>      cds->callback = colo_restore_setup_cds_done;
>      cds->ao = ao;
>      cds->domid = crs->domid;
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index e3bc257..d230ecd 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -1609,6 +1609,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
>                              uint32_t *domid, int restore_fd, int send_back_fd,
>                              const libxl_domain_restore_params *params,
>                              const char *colo_proxy_script,
> +                            const bool userspace_colo_proxy,
>                              const libxl_asyncop_how *ao_how,
>                              const libxl_asyncprogress_how *aop_console_how)
>  {
> @@ -1633,6 +1634,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
>      cdcs->dcs.callback = domain_create_cb;
>      cdcs->dcs.domid_soft_reset = INVALID_DOMID;
>      cdcs->dcs.colo_proxy_script = colo_proxy_script;
> +    cdcs->dcs.crs.cps.is_userspace_proxy = userspace_colo_proxy;
>      libxl__ao_progress_gethow(&cdcs->dcs.aop_console_how, aop_console_how);
>      cdcs->domid_out = domid;
>  
> @@ -1821,7 +1823,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
>  {
>      unset_disk_colo_restore(d_config);
>      return do_domain_create(ctx, d_config, domid, -1, -1, NULL, NULL,
> -                            ao_how, aop_console_how);
> +                            false, ao_how, aop_console_how);
>  }
>  
>  int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
> @@ -1832,16 +1834,19 @@ int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
>                                  const libxl_asyncprogress_how *aop_console_how)
>  {
>      char *colo_proxy_script = NULL;
> +    bool userspace_colo_proxy = false;
>  
>      if (params->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_COLO) {
>          colo_proxy_script = params->colo_proxy_script;
> +        userspace_colo_proxy = libxl_defbool_val(params->userspace_colo_proxy);

I think I'm going to ask for a bit of cleanup here.

You don't  actually need the values of colo_proxy_script and
userspace_colo_proxy here.

So instead of having both values here. I suggest:

1. provide a patch to refactor existing code so that do_domain_create
   doesn't take colo_proxy_script anymore. It should be able to do
   cdcs->dcs.colo_proxy_script = params->colo_proxy_script.
2. rework this patch on top of that patch.

Does this make sense? Let me know if this is not feasible due to I miss
something obvious.

>          set_disk_colo_restore(d_config);
>      } else {
>          unset_disk_colo_restore(d_config);
>      }
>  
>      return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
> -                            params, colo_proxy_script, ao_how, aop_console_how);
> +                            params, colo_proxy_script, userspace_colo_proxy,
> +                            ao_how, aop_console_how);
>  }
>  
>  int libxl_domain_soft_reset(libxl_ctx *ctx,
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 1bd2057..89c2c9d 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -390,6 +390,7 @@ libxl_domain_restore_params = Struct("domain_restore_params", [
>      ("checkpointed_stream", integer),
>      ("stream_version", uint32, {'init_val': '1'}),
>      ("colo_proxy_script", string),
> +    ("userspace_colo_proxy", libxl_defbool),

I suppose you can use LIBXL_HAVE_COLO_USERSPACE_PROXY for this whole
series.

Since this series touches a lot of common code, I would like you to
confirm you've tested configurations without COLO enabled. Basic VM
lifecycle operations like create, save/restore and migration should
still work.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:07PM +0800, Zhang Chen wrote:
> Qemu need this args to start userspace colo-proxy.
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>

Since we have:

   # Note that the COLO configuration settings should be considered unstable.
   # They may change incompatibly in future versions of Xen.

I have no major objection with this patch.

But I do wonder if you can reduce the repetition somehow.

See below.

> ---
>  tools/libxl/libxl_dm.c      | 104 ++++++++++++++++++++
>  tools/libxl/libxl_nic.c     | 232 ++++++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_types.idl |  31 +++++-
>  tools/libxl/xl_cmdimpl.c    |  58 +++++++++++
>  4 files changed, 424 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 281058d..b3484df 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
>          }
> diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
> index 61b55ca..b7a3596 100644
> --- a/tools/libxl/libxl_nic.c
> +++ b/tools/libxl/libxl_nic.c
> @@ -196,6 +196,123 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
>          flexarray_append(back, nic->coloft_forwarddev);
>      }
>  
> +    if (nic->sock_mirror_id) {
> +        flexarray_append(back, "sock_mirror_id");
> +        flexarray_append(back, nic->sock_mirror_id);
> +    }
> +    if (nic->sock_mirror_ip) {
> +        flexarray_append(back, "sock_mirror_ip");
> +        flexarray_append(back, nic->sock_mirror_ip);
> +    }

Here, please use a macro:

#define MAYBE_ADD_COLO_ARGS(arg) ...

     MAYBE_ADD_COLO_ARGS(sock_mirror_id);
     MAYBE_ADD_COLO_ARGS(sock_mirror_ip);
     ...
#undef MAYBE_ADD_COLO_ARGS
> +
>      flexarray_append(back, "mac");
>      flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
>      if (nic->ip) {
> @@ -348,6 +465,121 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
>                                  GCSPRINTF("%s/forwarddev", libxl_path),
>                                  (const char **)(&nic->coloft_forwarddev));
>      if (rc) goto out;
> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
> +                                GCSPRINTF("%s/sock_mirror_id", libxl_path),
> +                                (const char **)(&nic->sock_mirror_id));
> +    if (rc) goto out;

And another macro for this hunk.

> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
> +                                GCSPRINTF("%s/sock_mirror_ip", libxl_path),
> +                                (const char **)(&nic->sock_mirror_ip));
> +    if (rc) goto out;
> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
> +                                GCSPRINTF("%s/sock_mirror_port", libxl_path),
> +                                (const char **)(&nic->sock_mirror_port));
> +    if (rc) goto out;
> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
[...]
>  
>      /* 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 89c2c9d..1deb11b 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -629,7 +629,36 @@ libxl_device_nic = Struct("device_nic", [
>      ("gatewaydev", string),
>      # Note that the COLO configuration settings should be considered unstable.
>      # They may change incompatibly in future versions of Xen.
> -    ("coloft_forwarddev", string)
> +    ("coloft_forwarddev", string),
> +    ("sock_mirror_id", string),
> +    ("sock_mirror_ip", string),
> +    ("sock_mirror_port", string),
> +    ("sock_compare_pri_in_id", string),
> +    ("sock_compare_pri_in_ip", string),
> +    ("sock_compare_pri_in_port", string),
> +    ("sock_compare_sec_in_id", string),
> +    ("sock_compare_sec_in_ip", string),
> +    ("sock_compare_sec_in_port", string),
> +    ("sock_redirector0_id", string),
> +    ("sock_redirector0_ip", string),
> +    ("sock_redirector0_port", string),
> +    ("sock_redirector1_id", string),
> +    ("sock_redirector1_ip", string),
> +    ("sock_redirector1_port", string),
> +    ("sock_redirector2_id", string),
> +    ("sock_redirector2_ip", string),
> +    ("sock_redirector2_port", string),
> +    ("filter_mirror_queue", string),
> +    ("filter_mirror_outdev", string),
> +    ("filter_redirector0_queue", string),
> +    ("filter_redirector0_indev", string),
> +    ("filter_redirector0_outdev", string),
> +    ("filter_redirector1_queue", string),
> +    ("filter_redirector1_indev", string),
> +    ("filter_redirector1_outdev", string),

I suggest you prefix all these fields with colo_.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy start args
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:08PM +0800, Zhang Chen wrote:
> Qemu need this args to start userspace colo-proxy.
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>

See previous patch. Same comments apply here.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event.
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:05 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:09PM +0800, Zhang Chen wrote:
> 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@cn.fujitsu.com>

No major objection but this patch probably needs reworking if you change
your previous patches.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy
  2017-01-26  6:36 [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy Zhang Chen
                   ` (5 preceding siblings ...)
  2017-01-26  6:36 ` [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event Zhang Chen
@ 2017-01-27 17:08 ` Wei Liu
  2017-02-08  8:54   ` Zhang Chen
  6 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-01-27 17:08 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang,
	Xen devel, Bian Naimeng

On Thu, Jan 26, 2017 at 02:36:03PM +0800, Zhang Chen wrote:
> Hi~ All~ Happy Chinese New Year~~

Happy Chinese New Year to you, too!

I skimmed through this series and made some comments based on my
preliminary assessment. If you have any questions, feel free to ask.

I suppose we would need to have a few more rounds to hash out all the
details.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 1/6] COLO-Proxy: Add remus command to open userspace proxy
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-06  6:01     ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-06  6:01 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:04PM +0800, Zhang Chen wrote:
>> Add remus '-p' to enable userspace colo proxy(in qemu).
>>
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> ---
>>   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>.
>> +
> Use userspace COLO Proxy. This option must be used in conjunction with B<-c>.

OK.

>
>>   =back
>>   
>>   =item B<pause> I<domain-id>
>> 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)
> Please add a LIBXL_HAVE macro in libxl.h.

I will add #define LIBXL_HAVE_USERSPACE_COLO_PROXY 1 in libxl.h
In next version.

>
>>       ])
>>   
>>   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);
>> +
> Hmm... I think setting defaults should be pushed into libxl.
>
> But I think this is issue is orthogonal to this patch, and we can
> revisit this later.
>
>>       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");
> "Option -p must be used in conjunction with -c".
>
> And please use fprintf(stderr,...) here because libxl_defbool_val
> doesn't touch errno.

OK, I will fix this in next version.

>
>> +        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."
> "Use".

OK.

Thanks
Zhang Chen

>
> Wei.
>
>>       },
>>   #endif
>>       { "devd",
>> -- 
>> 2.7.4
>>
>>
>>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-06  6:32     ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-06  6:32 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:05PM +0800, Zhang Chen wrote:
>> In this patch we close kernel COLO-Proxy on primary side.
>>
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> I don't claim I know much about COLO though, nor have I ever run it, so
> it would be better to have a second eye on this patch.
>
> There are some style nits below.
>
>> ---
>>   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;
>> +    }
>> +
> There is only one statement so no need to have {}.
>
> You can move the comment before "if" and remove {}.
>
> Same rule applies to all the patches.

OK, I will fix this in next version.

Thanks
Zhang Chen

>
> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-06  9:27     ` Zhang Chen
  2017-02-06 11:25       ` Wei Liu
  0 siblings, 1 reply; 23+ messages in thread
From: Zhang Chen @ 2017-02-06  9:27 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:06PM +0800, Zhang Chen wrote:
>> In this patch we add a function to close
>> kernel COLO-Proxy on secondary side.
>>
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> ---
>>   tools/libxl/libxl_colo_restore.c |  9 +++++++--
>>   tools/libxl/libxl_create.c       |  9 +++++++--
>>   tools/libxl/libxl_types.idl      |  1 +
>>   tools/libxl/xl_cmdimpl.c         | 18 +++++++++++++++---
>>   4 files changed, 30 insertions(+), 7 deletions(-)
>>
>> diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c
>> index 6a96328..1d42539 100644
>> --- a/tools/libxl/libxl_colo_restore.c
>> +++ b/tools/libxl/libxl_colo_restore.c
>> @@ -774,8 +774,13 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc,
>>   
>>       STATE_AO_GC(crs->ao);
>>   
>> -    cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) |
>> -                             (1 << LIBXL__DEVICE_KIND_VBD);
>> +    if (crs->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);
>> +    }
>> +
> Style issue.

I will fix this in next version.

>
>>       cds->callback = colo_restore_setup_cds_done;
>>       cds->ao = ao;
>>       cds->domid = crs->domid;
>> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
>> index e3bc257..d230ecd 100644
>> --- a/tools/libxl/libxl_create.c
>> +++ b/tools/libxl/libxl_create.c
>> @@ -1609,6 +1609,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
>>                               uint32_t *domid, int restore_fd, int send_back_fd,
>>                               const libxl_domain_restore_params *params,
>>                               const char *colo_proxy_script,
>> +                            const bool userspace_colo_proxy,
>>                               const libxl_asyncop_how *ao_how,
>>                               const libxl_asyncprogress_how *aop_console_how)
>>   {
>> @@ -1633,6 +1634,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
>>       cdcs->dcs.callback = domain_create_cb;
>>       cdcs->dcs.domid_soft_reset = INVALID_DOMID;
>>       cdcs->dcs.colo_proxy_script = colo_proxy_script;
>> +    cdcs->dcs.crs.cps.is_userspace_proxy = userspace_colo_proxy;
>>       libxl__ao_progress_gethow(&cdcs->dcs.aop_console_how, aop_console_how);
>>       cdcs->domid_out = domid;
>>   
>> @@ -1821,7 +1823,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
>>   {
>>       unset_disk_colo_restore(d_config);
>>       return do_domain_create(ctx, d_config, domid, -1, -1, NULL, NULL,
>> -                            ao_how, aop_console_how);
>> +                            false, ao_how, aop_console_how);
>>   }
>>   
>>   int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
>> @@ -1832,16 +1834,19 @@ int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
>>                                   const libxl_asyncprogress_how *aop_console_how)
>>   {
>>       char *colo_proxy_script = NULL;
>> +    bool userspace_colo_proxy = false;
>>   
>>       if (params->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_COLO) {
>>           colo_proxy_script = params->colo_proxy_script;
>> +        userspace_colo_proxy = libxl_defbool_val(params->userspace_colo_proxy);
> I think I'm going to ask for a bit of cleanup here.
>
> You don't  actually need the values of colo_proxy_script and
> userspace_colo_proxy here.
>
> So instead of having both values here. I suggest:
>
> 1. provide a patch to refactor existing code so that do_domain_create
>     doesn't take colo_proxy_script anymore. It should be able to do
>     cdcs->dcs.colo_proxy_script = params->colo_proxy_script.
> 2. rework this patch on top of that patch.
>
> Does this make sense? Let me know if this is not feasible due to I miss
> something obvious.

Good idea, I will follow your comments send a new patch in next version.

>
>>           set_disk_colo_restore(d_config);
>>       } else {
>>           unset_disk_colo_restore(d_config);
>>       }
>>   
>>       return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
>> -                            params, colo_proxy_script, ao_how, aop_console_how);
>> +                            params, colo_proxy_script, userspace_colo_proxy,
>> +                            ao_how, aop_console_how);
>>   }
>>   
>>   int libxl_domain_soft_reset(libxl_ctx *ctx,
>> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
>> index 1bd2057..89c2c9d 100644
>> --- a/tools/libxl/libxl_types.idl
>> +++ b/tools/libxl/libxl_types.idl
>> @@ -390,6 +390,7 @@ libxl_domain_restore_params = Struct("domain_restore_params", [
>>       ("checkpointed_stream", integer),
>>       ("stream_version", uint32, {'init_val': '1'}),
>>       ("colo_proxy_script", string),
>> +    ("userspace_colo_proxy", libxl_defbool),
> I suppose you can use LIBXL_HAVE_COLO_USERSPACE_PROXY for this whole
> series.

If I understand correctly, we use LIBXL_HAVE_COLO_USERSPACE_PROXY for
this whole series means we make colo userspace proxy as default option,
User can't use colo kernel proxy by a easy way (remus commands).
The goal of this series is to provide a another way to run colo proxy(we 
recommended),
We want to keep the colo kernel proxy function currently(maybe someone can
maintain it), and when colo userspace proxy performance better than 
kernel proxy,
we will change colo userspace as default option.


Thanks
Zhang Chen


>
> Since this series touches a lot of common code, I would like you to
> confirm you've tested configurations without COLO enabled. Basic VM
> lifecycle operations like create, save/restore and migration should
> still work.
>
> Wei.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
>
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side
  2017-02-06  9:27     ` Zhang Chen
@ 2017-02-06 11:25       ` Wei Liu
  2017-02-07  1:39         ` Zhang Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Wei Liu @ 2017-02-06 11:25 UTC (permalink / raw)
  To: Zhang Chen
  Cc: Wei Liu, Li Zhijian, eddie . dong, Ian Jackson, Yang Hongyang,
	Xen devel, Bian Naimeng

On Mon, Feb 06, 2017 at 05:27:43PM +0800, Zhang Chen wrote:
[...]
> 
> > 
> > >           set_disk_colo_restore(d_config);
> > >       } else {
> > >           unset_disk_colo_restore(d_config);
> > >       }
> > >       return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
> > > -                            params, colo_proxy_script, ao_how, aop_console_how);
> > > +                            params, colo_proxy_script, userspace_colo_proxy,
> > > +                            ao_how, aop_console_how);
> > >   }
> > >   int libxl_domain_soft_reset(libxl_ctx *ctx,
> > > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> > > index 1bd2057..89c2c9d 100644
> > > --- a/tools/libxl/libxl_types.idl
> > > +++ b/tools/libxl/libxl_types.idl
> > > @@ -390,6 +390,7 @@ libxl_domain_restore_params = Struct("domain_restore_params", [
> > >       ("checkpointed_stream", integer),
> > >       ("stream_version", uint32, {'init_val': '1'}),
> > >       ("colo_proxy_script", string),
> > > +    ("userspace_colo_proxy", libxl_defbool),
> > I suppose you can use LIBXL_HAVE_COLO_USERSPACE_PROXY for this whole
> > series.
> 
> If I understand correctly, we use LIBXL_HAVE_COLO_USERSPACE_PROXY for
> this whole series means we make colo userspace proxy as default option,
> User can't use colo kernel proxy by a easy way (remus commands).
> The goal of this series is to provide a another way to run colo proxy(we
> recommended),
> We want to keep the colo kernel proxy function currently(maybe someone can
> maintain it), and when colo userspace proxy performance better than kernel
> proxy,
> we will change colo userspace as default option.
> 

No, that macro is not used to denote which mechanism is the default one.
It is used to indicate the availability of a particular thing in libxl.
So you can have that macro and choose whichever you want to be the
default.

Feel free to ask questions if I'm not clear enough.

Wei.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 3/6] COLO-Proxy: Setup userspace colo-proxy on secondary side
  2017-02-06 11:25       ` Wei Liu
@ 2017-02-07  1:39         ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-07  1:39 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 02/06/2017 07:25 PM, Wei Liu wrote:
> On Mon, Feb 06, 2017 at 05:27:43PM +0800, Zhang Chen wrote:
> [...]
>>>>            set_disk_colo_restore(d_config);
>>>>        } else {
>>>>            unset_disk_colo_restore(d_config);
>>>>        }
>>>>        return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
>>>> -                            params, colo_proxy_script, ao_how, aop_console_how);
>>>> +                            params, colo_proxy_script, userspace_colo_proxy,
>>>> +                            ao_how, aop_console_how);
>>>>    }
>>>>    int libxl_domain_soft_reset(libxl_ctx *ctx,
>>>> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
>>>> index 1bd2057..89c2c9d 100644
>>>> --- a/tools/libxl/libxl_types.idl
>>>> +++ b/tools/libxl/libxl_types.idl
>>>> @@ -390,6 +390,7 @@ libxl_domain_restore_params = Struct("domain_restore_params", [
>>>>        ("checkpointed_stream", integer),
>>>>        ("stream_version", uint32, {'init_val': '1'}),
>>>>        ("colo_proxy_script", string),
>>>> +    ("userspace_colo_proxy", libxl_defbool),
>>> I suppose you can use LIBXL_HAVE_COLO_USERSPACE_PROXY for this whole
>>> series.
>> If I understand correctly, we use LIBXL_HAVE_COLO_USERSPACE_PROXY for
>> this whole series means we make colo userspace proxy as default option,
>> User can't use colo kernel proxy by a easy way (remus commands).
>> The goal of this series is to provide a another way to run colo proxy(we
>> recommended),
>> We want to keep the colo kernel proxy function currently(maybe someone can
>> maintain it), and when colo userspace proxy performance better than kernel
>> proxy,
>> we will change colo userspace as default option.
>>
> No, that macro is not used to denote which mechanism is the default one.
> It is used to indicate the availability of a particular thing in libxl.
> So you can have that macro and choose whichever you want to be the
> default.
>
> Feel free to ask questions if I'm not clear enough.

OK. I will add the macro "LIBXL_HAVE_COLO_USERSPACE_PROXY"
like the "LIBXL_HAVE_REMUS".

Thank you for your nice comments.
Zhang Chen

> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 4/6] COLO-Proxy: Add primary userspace colo proxy start args
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-08  8:53     ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-08  8:53 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:07PM +0800, Zhang Chen wrote:
>> Qemu need this args to start userspace colo-proxy.
>>
>> Signed-off-by: Zhang Chen<zhangchen.fnst@cn.fujitsu.com>
> Since we have:
>
>     # Note that the COLO configuration settings should be considered unstable.
>     # They may change incompatibly in future versions of Xen.
>
> I have no major objection with this patch.
>
> But I do wonder if you can reduce the repetition somehow.
>
> See below.
>
>> ---
>>   tools/libxl/libxl_dm.c      | 104 ++++++++++++++++++++
>>   tools/libxl/libxl_nic.c     | 232 ++++++++++++++++++++++++++++++++++++++++++++
>>   tools/libxl/libxl_types.idl |  31 +++++-
>>   tools/libxl/xl_cmdimpl.c    |  58 +++++++++++
>>   4 files changed, 424 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>> index 281058d..b3484df 100644
>> --- a/tools/libxl/libxl_dm.c
>> +++ b/tools/libxl/libxl_dm.c
>>           }
>> diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
>> index 61b55ca..b7a3596 100644
>> --- a/tools/libxl/libxl_nic.c
>> +++ b/tools/libxl/libxl_nic.c
>> @@ -196,6 +196,123 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
>>           flexarray_append(back, nic->coloft_forwarddev);
>>       }
>>   
>> +    if (nic->sock_mirror_id) {
>> +        flexarray_append(back, "sock_mirror_id");
>> +        flexarray_append(back, nic->sock_mirror_id);
>> +    }
>> +    if (nic->sock_mirror_ip) {
>> +        flexarray_append(back, "sock_mirror_ip");
>> +        flexarray_append(back, nic->sock_mirror_ip);
>> +    }
> Here, please use a macro:
>
> #define MAYBE_ADD_COLO_ARGS(arg) ...
>
>       MAYBE_ADD_COLO_ARGS(sock_mirror_id);
>       MAYBE_ADD_COLO_ARGS(sock_mirror_ip);
>       ...
> #undef MAYBE_ADD_COLO_ARGS

Make sense, I will fix it in next version.

>> +
>>       flexarray_append(back, "mac");
>>       flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
>>       if (nic->ip) {
>> @@ -348,6 +465,121 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
>>                                   GCSPRINTF("%s/forwarddev", libxl_path),
>>                                   (const char **)(&nic->coloft_forwarddev));
>>       if (rc) goto out;
>> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
>> +                                GCSPRINTF("%s/sock_mirror_id", libxl_path),
>> +                                (const char **)(&nic->sock_mirror_id));
>> +    if (rc) goto out;
> And another macro for this hunk.

OK.

>> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
>> +                                GCSPRINTF("%s/sock_mirror_ip", libxl_path),
>> +                                (const char **)(&nic->sock_mirror_ip));
>> +    if (rc) goto out;
>> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
>> +                                GCSPRINTF("%s/sock_mirror_port", libxl_path),
>> +                                (const char **)(&nic->sock_mirror_port));
>> +    if (rc) goto out;
>> +    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
> [...]
>>   
>>       /* 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 89c2c9d..1deb11b 100644
>> --- a/tools/libxl/libxl_types.idl
>> +++ b/tools/libxl/libxl_types.idl
>> @@ -629,7 +629,36 @@ libxl_device_nic = Struct("device_nic", [
>>       ("gatewaydev", string),
>>       # Note that the COLO configuration settings should be considered unstable.
>>       # They may change incompatibly in future versions of Xen.
>> -    ("coloft_forwarddev", string)
>> +    ("coloft_forwarddev", string),
>> +    ("sock_mirror_id", string),
>> +    ("sock_mirror_ip", string),
>> +    ("sock_mirror_port", string),
>> +    ("sock_compare_pri_in_id", string),
>> +    ("sock_compare_pri_in_ip", string),
>> +    ("sock_compare_pri_in_port", string),
>> +    ("sock_compare_sec_in_id", string),
>> +    ("sock_compare_sec_in_ip", string),
>> +    ("sock_compare_sec_in_port", string),
>> +    ("sock_redirector0_id", string),
>> +    ("sock_redirector0_ip", string),
>> +    ("sock_redirector0_port", string),
>> +    ("sock_redirector1_id", string),
>> +    ("sock_redirector1_ip", string),
>> +    ("sock_redirector1_port", string),
>> +    ("sock_redirector2_id", string),
>> +    ("sock_redirector2_ip", string),
>> +    ("sock_redirector2_port", string),
>> +    ("filter_mirror_queue", string),
>> +    ("filter_mirror_outdev", string),
>> +    ("filter_redirector0_queue", string),
>> +    ("filter_redirector0_indev", string),
>> +    ("filter_redirector0_outdev", string),
>> +    ("filter_redirector1_queue", string),
>> +    ("filter_redirector1_indev", string),
>> +    ("filter_redirector1_outdev", string),
> I suggest you prefix all these fields with colo_.

OK, will fix in next version.

Thanks
Zhang Chen

> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy start args
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-08  8:53     ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-08  8:53 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:08PM +0800, Zhang Chen wrote:
>> Qemu need this args to start userspace colo-proxy.
>>
>> Signed-off-by: Zhang Chen<zhangchen.fnst@cn.fujitsu.com>
> See previous patch. Same comments apply here.

OK~ I will fix it in next version.

Thanks
Zhang Chen

> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 6/6] COLO-Proxy: Use socket to get checkpoint event.
  2017-01-27 17:05   ` Wei Liu
@ 2017-02-08  8:54     ` Zhang Chen
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-08  8:54 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:05 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:09PM +0800, Zhang Chen wrote:
>> 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@cn.fujitsu.com>
> No major objection but this patch probably needs reworking if you change
> your previous patches.

Yes. I will reworking this patch and send in next version.

Thanks
Zhang Chen

> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 0/6] COLO-Proxy: Make Xen COLO use userspace colo-proxy
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Zhang Chen @ 2017-02-08  8:54 UTC (permalink / raw)
  To: Wei Liu
  Cc: Li Zhijian, Ian Jackson, eddie . dong, Yang Hongyang, Xen devel,
	Bian Naimeng



On 01/28/2017 01:08 AM, Wei Liu wrote:
> On Thu, Jan 26, 2017 at 02:36:03PM +0800, Zhang Chen wrote:
>> Hi~ All~ Happy Chinese New Year~~
> Happy Chinese New Year to you, too!
>
> I skimmed through this series and made some comments based on my
> preliminary assessment. If you have any questions, feel free to ask.
>
> I suppose we would need to have a few more rounds to hash out all the
> details.

Thank you for your warm-hearted review, I will follow
your comments to improve the next version.

Zhang Chen

> Wei.
>
>
> .
>

-- 
Thanks
Zhang Chen




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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-02-08  8:55 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH RFC 2/6] COLO-Proxy: Setup userspace colo-proxy on primary side Zhang Chen
2017-01-27 17:05   ` 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

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.