diff mbox

[V3,1/7] COLO-Proxy: Add remus command to open userspace proxy

Message ID 1487297909-1885-2-git-send-email-zhangchen.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang Chen Feb. 17, 2017, 2:18 a.m. UTC
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          |  5 +++++
 tools/libxl/libxl.h           |  6 ++++++
 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 ++-
 7 files changed, 41 insertions(+), 10 deletions(-)

Comments

Wei Liu Feb. 20, 2017, 3:50 p.m. UTC | #1
On Fri, Feb 17, 2017 at 10:18:23AM +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          |  5 +++++
>  tools/libxl/libxl.h           |  6 ++++++
>  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 ++-
>  7 files changed, 41 insertions(+), 10 deletions(-)
> 
> diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
> index 09c1faa..4260777 100644
> --- a/docs/man/xl.pod.1.in
> +++ b/docs/man/xl.pod.1.in
> @@ -553,6 +553,11 @@ 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>
> +
> +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.h b/tools/libxl/libxl.h
> index 3924464..fce7fab 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -870,6 +870,12 @@ typedef struct libxl__ctx libxl_ctx;
>   */
>  #define LIBXL_HAVE_REMUS 1
>  
> +/*
> + * LIBXL_HAVE_COLO_USERSPACE_PROXY
> + * If this is defined, then libxl supports COLO userspace proxy.
> + */
> +#define LIBXL_HAVE_COLO_USERSPACE_PROXY 1
> +

Please add this macro in a separate patch. It shall be the last patch of
this series. That way we don't break bisection for libxl users.

Wei.
Zhang Chen Feb. 21, 2017, 2:49 a.m. UTC | #2
On 02/20/2017 11:50 PM, Wei Liu wrote:
> On Fri, Feb 17, 2017 at 10:18:23AM +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          |  5 +++++
>>   tools/libxl/libxl.h           |  6 ++++++
>>   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 ++-
>>   7 files changed, 41 insertions(+), 10 deletions(-)
>>
>> diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
>> index 09c1faa..4260777 100644
>> --- a/docs/man/xl.pod.1.in
>> +++ b/docs/man/xl.pod.1.in
>> @@ -553,6 +553,11 @@ 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>
>> +
>> +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.h b/tools/libxl/libxl.h
>> index 3924464..fce7fab 100644
>> --- a/tools/libxl/libxl.h
>> +++ b/tools/libxl/libxl.h
>> @@ -870,6 +870,12 @@ typedef struct libxl__ctx libxl_ctx;
>>    */
>>   #define LIBXL_HAVE_REMUS 1
>>   
>> +/*
>> + * LIBXL_HAVE_COLO_USERSPACE_PROXY
>> + * If this is defined, then libxl supports COLO userspace proxy.
>> + */
>> +#define LIBXL_HAVE_COLO_USERSPACE_PROXY 1
>> +
> Please add this macro in a separate patch. It shall be the last patch of
> this series. That way we don't break bisection for libxl users.

I got your point.

Thanks
Zhang Chen

>
> Wei.
>
>
> .
>
diff mbox

Patch

diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
index 09c1faa..4260777 100644
--- a/docs/man/xl.pod.1.in
+++ b/docs/man/xl.pod.1.in
@@ -553,6 +553,11 @@  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>
+
+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.h b/tools/libxl/libxl.h
index 3924464..fce7fab 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -870,6 +870,12 @@  typedef struct libxl__ctx libxl_ctx;
  */
 #define LIBXL_HAVE_REMUS 1
 
+/*
+ * LIBXL_HAVE_COLO_USERSPACE_PROXY
+ * If this is defined, then libxl supports COLO userspace proxy.
+ */
+#define LIBXL_HAVE_COLO_USERSPACE_PROXY 1
+
 typedef uint8_t libxl_mac[6];
 #define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
 #define LIBXL_MAC_FMTLEN ((2*6)+5) /* 6 hex bytes plus 5 colons */
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..99baeef 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)) {
+        fprintf(stderr, "Option -p must be used in conjunction 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..409eceb 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                      Use COLO userspace proxy."
     },
 #endif
     { "devd",