COLO-Proxy: Make Xen COLO use userspace colo-proxy
v4 cover COLO-Proxy: Make Xen COLO use userspace colo-proxy
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
V4:
- Because the origin 3/7 has been merged,
remove it in this series.
- Add new patch "COLO-Proxy: Add colo-compare notify args" to support qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.html
- Add colo_userspace_proxy macro as a separate patch.
- Add some comments about COLO and fix some typo in patch 2/7.
- Fix some bug and typo in patch 7/7.
- Rebase codes on upstream Xen.
V3:
- remove the 'RFC' tag.
- fix some bug in patch 7/7.
- fix codestyle.
V2:
- Address wei's comments, use macro to reuse codes.
- Do some work on the last patch.
- Fix some typo.
- Add LIBXL_HAVE_COLO_USERSPACE_PROXY macro in libxl.h.
- Some bug fix.
V1:
- Initial patch
Zhang Chen (8):
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: Add colo-compare notify args
COLO-Proxy: Use socket to get checkpoint event.
COLO-proxy: Add colo_userspace_proxy macro
docs/man/xl.pod.1.in | 5 ++ tools/libxl/libxl.h | 6 ++ tools/libxl/libxl_colo.h | 7 ++ tools/libxl/libxl_colo_proxy.c | 149 +++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_colo_restore.c | 19 +++-- tools/libxl/libxl_colo_save.c | 18 ++++- tools/libxl/libxl_create.c | 8 ++- tools/libxl/libxl_dm.c | 138 ++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_nic.c | 117 ++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 68 +++++++++++++++--- tools/xl/xl.h | 1 + tools/xl/xl_cmdtable.c | 3 +- tools/xl/xl_migrate.c | 28 ++++++-- tools/xl/xl_parse.c | 97 +++++++++++++++++++++++++ tools/xl/xl_vmcontrol.c | 2 + 15 files changed, 642 insertions(+), 24 deletions(-)
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v4 1/8 COLO-Proxy: Add remus command to open userspace proxy
Add remus '-p' to enable userspace colo proxy(in qemu).
--- docs/man/xl.pod.1.in | 5 +++++ tools/libxl/libxl_colo.h | 5 +++++ tools/libxl/libxl_colo_save.c | 2 ++ tools/libxl/libxl_types.idl | 17 +++++++++-------- tools/xl/xl_cmdtable.c | 3 ++- tools/xl/xl_migrate.c | 13 ++++++++++++- 6 files changed, 35 insertions(+), 10 deletions(-)
docs/man/xl.pod.1.in +5 -0
@@ -563,6 +563,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>
tools/libxl/libxl_colo.h +5 -0
@@ -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 {
tools/libxl/libxl_colo_save.c +2 -0
@@ -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);
tools/libxl/libxl_types.idl +9 -8
@@ -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", [
tools/xl/xl_cmdtable.c +2 -1
@@ -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",
tools/xl/xl_migrate.c +12 -1
@@ -609,7 +609,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 ;
@@ -639,6 +639,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]);
@@ -647,9 +650,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) ||
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 1/8] COLO-Proxy: Add remus command to open userspace proxy
Quoted 3 lines · Zhang Chen
Add remus '-p' to enable userspace colo proxy(in qemu).
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v4 2/8 COLO-Proxy: Setup userspace colo-proxy on primary side
In reply to Zhang ChenIn this patch we close kernel COLO-Proxy on primary side.
--- tools/libxl/libxl_colo_proxy.c | 31 +++++++++++++++++++++++++++++++ tools/libxl/libxl_colo_save.c | 9 +++++++-- 2 files changed, 38 insertions(+), 2 deletions(-)
tools/libxl/libxl_colo_proxy.c +31 -0
@@ -152,6 +152,10 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)STATE_AO_GC (cps->ao); +/* If enable userspace proxy mode, we don't need setup kernel proxy */ +if (cps->is_userspace_proxy) +return 0 ; + skfd =socket (PF_NETLINK ,SOCK_RAW ,NETLINK_COLO );if (skfd <0 ) {LOGD (ERROR , ao->domid,"can not create a netlink socket: %s" ,strerror (errno));
@@ -222,6 +226,13 @@ out:void colo_proxy_teardown (libxl__colo_proxy_state *cps) { +/* +* If enable userspace proxy mode, +* we don't need teardown kernel proxy +*/ +if (cps->is_userspace_proxy) +return ; +if (cps->sock_fd >=0 ) {close (cps->sock_fd); cps->sock_fd =-1 ;
@@ -232,6 +243,13 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps)void colo_proxy_preresume (libxl__colo_proxy_state *cps) { +/* +* If enable userspace proxy mode, +* we don't need preresume kernel proxy +*/ +if (cps->is_userspace_proxy) +return ; +colo_proxy_send (cps,NULL ,0 ,COLO_CHECKPOINT );/* TODO: need to handle if the call fails... */ }
@@ -262,6 +280,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,STATE_AO_GC (cps->ao); +/* +* Enable userspace proxy to periodical checkpoint mode, +* sleeping temporarily for colo userspace proxy mode. +* then we will use socket recv instead of this usleep. +* In other words, we use socket communicate with Qemu +* Proxy part(colo-compare), for example, notify checkpoint +* event. +*/ +if (cps->is_userspace_proxy) { +usleep (timeout_us); +return 0 ; + } + size =colo_proxy_recv (cps, &buff, timeout_us);/* timeout, return no checkpoint message. */
tools/libxl/libxl_colo_save.c +7 -2
@@ -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;
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 2/8] COLO-Proxy: Setup userspace colo-proxy on primary side
Quoted 3 lines · Zhang Chen
In this patch we close kernel COLO-Proxy on primary side.
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v4 3/8 COLO-Proxy: Setup userspace colo-proxy on secondary side
In reply to Zhang ChenIn this patch we add a function to close COLO kernel Proxy on secondary side.
--- tools/libxl/libxl_colo_restore.c | 8 ++++++-- tools/libxl/libxl_create.c | 8 ++++++-- tools/libxl/libxl_types.idl | 1 + tools/xl/xl.h | 1 + tools/xl/xl_migrate.c | 15 ++++++++++++--- tools/xl/xl_vmcontrol.c | 2 ++ 6 files changed, 28 insertions(+), 7 deletions(-)
tools/libxl/libxl_colo_restore.c +6 -2
@@ -774,8 +774,12 @@ 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;
tools/libxl/libxl_create.c +6 -2
@@ -1633,11 +1633,15 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config, cdcs->dcs.domid_soft_reset =INVALID_DOMID ;if (cdcs->dcs.restore_params.checkpointed_stream == -LIBXL_CHECKPOINTED_STREAM_COLO ) +LIBXL_CHECKPOINTED_STREAM_COLO ) { cdcs->dcs.colo_proxy_script = cdcs->dcs.restore_params.colo_proxy_script; -else + cdcs->dcs.crs.cps.is_userspace_proxy = +libxl_defbool_val (cdcs->dcs.restore_params.userspace_colo_proxy); + }else { cdcs->dcs.colo_proxy_script =NULL ; + cdcs->dcs.crs.cps.is_userspace_proxy = false; + }libxl__ao_progress_gethow (&cdcs->dcs.aop_console_how, aop_console_how); cdcs->domid_out = domid;
tools/libxl/libxl_types.idl +1 -0
@@ -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",[
tools/xl/xl.h +1 -0
@@ -45,6 +45,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 */
tools/xl/xl_migrate.c +12 -3
@@ -321,7 +321,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;
@@ -349,6 +350,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 ) {
@@ -480,11 +482,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 };
@@ -508,6 +512,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 ;
@@ -519,7 +526,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 ; }
@@ -700,11 +707,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" ); } }
tools/xl/xl_vmcontrol.c +2 -0
@@ -881,6 +881,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 (¶ms.userspace_colo_proxy, + dom_info->userspace_colo_proxy); ret = libxl_domain_create_restore(ctx, &d_config, &domid, restore_fd,
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 3/8] COLO-Proxy: Setup userspace colo-proxy on secondary side
Quoted 3 lines · Zhang Chen
In this patch we add a function to close COLO kernel Proxy on secondary side.
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v4 4/8 COLO-Proxy: Add primary userspace colo proxy start args
In reply to Zhang ChenQemu need this args to start userspace colo-proxy.
--- tools/libxl/libxl_dm.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_nic.c | 78 ++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 31 +++++++++++++- tools/xl/xl_parse.c | 58 +++++++++++++++++++++++++++ 4 files changed, 264 insertions(+), 1 deletion(-)
tools/libxl/libxl_dm.c +98 -0
@@ -1244,7 +1244,105 @@ 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 */ +#define APPEND_COLO_SOCK_SERVER (sock_id, sock_ip, sock_port) ({ \ + if (nics[i].colo_##sock_id && \ + nics[i].colo_##sock_ip && \ + nics[i].colo_##sock_port) { \ + flexarray_append(dm_args, "-chardev"); \ + flexarray_append(dm_args, \ + GCSPRINTF("socket,id=%s,host=%s,port=%s,server,nowait", \ + nics[i].colo_##sock_id, \ + nics[i].colo_##sock_ip, \ + nics[i].colo_##sock_port)); \ + } \ +}) + +#define APPEND_COLO_SOCK_CLIENT (sock_id, sock_ip, sock_port) ({ \ + if (nics[i].colo_##sock_id && \ + nics[i].colo_##sock_ip && \ + nics[i].colo_##sock_port) { \ + flexarray_append(dm_args, "-chardev"); \ + flexarray_append(dm_args, \ + GCSPRINTF("socket,id=%s,host=%s,port=%s", \ + nics[i].colo_##sock_id, \ + nics[i].colo_##sock_ip, \ + nics[i].colo_##sock_port)); \ + } \ +}) + +if (state->saved_state) { +/* secondary colo run */ + }else { +/* primary colo run */ + +APPEND_COLO_SOCK_SERVER (sock_mirror_id, + sock_mirror_ip, + sock_mirror_port); + +APPEND_COLO_SOCK_SERVER (sock_compare_pri_in_id, + sock_compare_pri_in_ip, + sock_compare_pri_in_port); + +APPEND_COLO_SOCK_SERVER (sock_compare_sec_in_id, + sock_compare_sec_in_ip, + sock_compare_sec_in_port); + +APPEND_COLO_SOCK_SERVER (sock_redirector0_id, + sock_redirector0_ip, + sock_redirector0_port); + +APPEND_COLO_SOCK_CLIENT (sock_redirector1_id, + sock_redirector1_ip, + sock_redirector1_port); + +APPEND_COLO_SOCK_CLIENT (sock_redirector2_id, + sock_redirector2_ip, + sock_redirector2_port); + +if (nics[i].colo_filter_mirror_queue && + nics[i].colo_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].colo_filter_mirror_queue, + nics[i].colo_filter_mirror_outdev)); + } +if (nics[i].colo_filter_redirector0_queue && + nics[i].colo_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].colo_filter_redirector0_queue, + nics[i].colo_filter_redirector0_indev)); + } +if (nics[i].colo_filter_redirector1_queue && + nics[i].colo_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].colo_filter_redirector1_queue, + nics[i].colo_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++; + +#undef APPEND_COLO_SOCK_SERVER +#undef APPEND_COLO_SOCK_CLIENT } }/* If we have no emulated nics, tell qemu not to create any */
tools/libxl/libxl_nic.c +78 -0
90 lines not on this page · raw message
tools/libxl/libxl_types.idl +30 -1
@@ -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), + ("colo_sock_mirror_id", string), + ("colo_sock_mirror_ip", string), + ("colo_sock_mirror_port", string), + ("colo_sock_compare_pri_in_id", string), + ("colo_sock_compare_pri_in_ip", string), + ("colo_sock_compare_pri_in_port", string), + ("colo_sock_compare_sec_in_id", string), + ("colo_sock_compare_sec_in_ip", string), + ("colo_sock_compare_sec_in_port", string), + ("colo_sock_redirector0_id", string), + ("colo_sock_redirector0_ip", string), + ("colo_sock_redirector0_port", string), + ("colo_sock_redirector1_id", string), + ("colo_sock_redirector1_ip", string), + ("colo_sock_redirector1_port", string), + ("colo_sock_redirector2_id", string), + ("colo_sock_redirector2_ip", string), + ("colo_sock_redirector2_port", string), + ("colo_filter_mirror_queue", string), + ("colo_filter_mirror_outdev", string), + ("colo_filter_redirector0_queue", string), + ("colo_filter_redirector0_indev", string), + ("colo_filter_redirector0_outdev", string), + ("colo_filter_redirector1_queue", string), + ("colo_filter_redirector1_indev", string), + ("colo_filter_redirector1_outdev", string), + ("colo_compare_pri_in", string), + ("colo_compare_sec_in", string), + ("colo_compare_out", string) ]) libxl_device_pci = Struct("device_pci", [
tools/xl/xl_parse.c +58 -0
64 lines not on this page · raw message
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 4/8] COLO-Proxy: Add primary userspace colo proxy start args
Quoted 3 lines · Zhang Chen
Qemu need this args to start userspace colo-proxy.
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v4 5/8 COLO-Proxy: Add secondary userspace colo-proxy start args
In reply to Zhang ChenQemu need this args to start userspace colo-proxy.
--- tools/libxl/libxl_dm.c | 34 ++++++++++++++++++++++++++++++++++ tools/libxl/libxl_nic.c | 27 +++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 15 ++++++++++++++- tools/xl/xl_parse.c | 27 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-)
tools/libxl/libxl_dm.c +34 -0
@@ -1274,6 +1274,40 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,if (state->saved_state) {/* secondary colo run */ + +APPEND_COLO_SOCK_CLIENT (sock_sec_redirector0_id, + sock_sec_redirector0_ip, + sock_sec_redirector0_port); + +APPEND_COLO_SOCK_CLIENT (sock_sec_redirector1_id, + sock_sec_redirector1_ip, + sock_sec_redirector1_port); + +if (nics[i].colo_filter_sec_redirector0_queue && + nics[i].colo_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].colo_filter_sec_redirector0_queue, + nics[i].colo_filter_sec_redirector0_indev)); + } +if (nics[i].colo_filter_sec_redirector1_queue && + nics[i].colo_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].colo_filter_sec_redirector1_queue, + nics[i].colo_filter_sec_redirector1_outdev)); + } +if (nics[i].colo_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].colo_filter_sec_rewriter0_queue)); + } }else {/* primary colo run */
tools/libxl/libxl_nic.c +27 -0
@@ -233,6 +233,20 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,MAYBE_ADD_COLO_ARGS (compare_sec_in);MAYBE_ADD_COLO_ARGS (compare_out); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector0_id); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector0_ip); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector0_port); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector1_id); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector1_ip); +MAYBE_ADD_COLO_ARGS (sock_sec_redirector1_port); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector0_queue); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector0_indev); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector0_outdev); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector1_queue); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector1_indev); +MAYBE_ADD_COLO_ARGS (filter_sec_redirector1_outdev); +MAYBE_ADD_COLO_ARGS (filter_sec_rewriter0_queue); +#undef MAYBE_ADD_COLO_ARGSflexarray_append (back,"mac" );
@@ -424,6 +438,19 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,CHECK_COLO_ARGS (compare_pri_in);CHECK_COLO_ARGS (compare_sec_in);CHECK_COLO_ARGS (compare_out); +CHECK_COLO_ARGS (sock_sec_redirector0_id); +CHECK_COLO_ARGS (sock_sec_redirector0_ip); +CHECK_COLO_ARGS (sock_sec_redirector0_port); +CHECK_COLO_ARGS (sock_sec_redirector1_id); +CHECK_COLO_ARGS (sock_sec_redirector1_ip); +CHECK_COLO_ARGS (sock_sec_redirector1_port); +CHECK_COLO_ARGS (filter_sec_redirector0_queue); +CHECK_COLO_ARGS (filter_sec_redirector0_indev); +CHECK_COLO_ARGS (filter_sec_redirector0_outdev); +CHECK_COLO_ARGS (filter_sec_redirector1_queue); +CHECK_COLO_ARGS (filter_sec_redirector1_indev); +CHECK_COLO_ARGS (filter_sec_redirector1_outdev); +CHECK_COLO_ARGS (filter_sec_rewriter0_queue);#undef CHECK_COLO_ARGS
tools/libxl/libxl_types.idl +14 -1
@@ -658,7 +658,20 @@ libxl_device_nic = Struct("device_nic", [ ("colo_filter_redirector1_outdev", string), ("colo_compare_pri_in", string), ("colo_compare_sec_in", string), - ("colo_compare_out", string) + ("colo_compare_out", string), + ("colo_sock_sec_redirector0_id", string), + ("colo_sock_sec_redirector0_ip", string), + ("colo_sock_sec_redirector0_port", string), + ("colo_sock_sec_redirector1_id", string), + ("colo_sock_sec_redirector1_ip", string), + ("colo_sock_sec_redirector1_port", string), + ("colo_filter_sec_redirector0_queue", string), + ("colo_filter_sec_redirector0_indev", string), + ("colo_filter_sec_redirector0_outdev", string), + ("colo_filter_sec_redirector1_queue", string), + ("colo_filter_sec_redirector1_indev", string), + ("colo_filter_sec_redirector1_outdev", string), + ("colo_filter_sec_rewriter0_queue", string) ]) libxl_device_pci = Struct("device_pci", [
tools/xl/xl_parse.c +27 -0
@@ -516,6 +516,33 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)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 ("colo_sock_sec_redirector0_id" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector0_id, oparg); + }else if (MATCH_OPTION ("colo_sock_sec_redirector0_ip" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector0_ip, oparg); + }else if (MATCH_OPTION ("colo_sock_sec_redirector0_port" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector0_port, oparg); + }else if (MATCH_OPTION ("colo_sock_sec_redirector1_id" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector1_id, oparg); + }else if (MATCH_OPTION ("colo_sock_sec_redirector1_ip" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector1_ip, oparg); + }else if (MATCH_OPTION ("colo_sock_sec_redirector1_port" , token, oparg)) { +replace_string (&nic->colo_sock_sec_redirector1_port, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector0_queue" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector0_queue, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector0_indev" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector0_indev, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector0_outdev" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector0_outdev, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector1_queue" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector1_queue, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector1_indev" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector1_indev, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_redirector1_outdev" , token, oparg)) { +replace_string (&nic->colo_filter_sec_redirector1_outdev, oparg); + }else if (MATCH_OPTION ("colo_filter_sec_rewriter0_queue" , token, oparg)) { +replace_string (&nic->colo_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 if (MATCH_OPTION ("devid" , token, oparg)) {
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 5/8] COLO-Proxy: Add secondary userspace colo-proxy start args
Quoted 3 lines · Zhang Chen
Qemu need this args to start userspace colo-proxy.
Signed-off-by Zhang Chen <[email protected]>
tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) · line 519
Quoted 9 lines
tools/xl/xl_parse.c +1
-0@@ -516,6 +516,33 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)replace_string (&nic->colo_compare_sec_in, oparg); }else if (MATCH_OPTION ("colo_compare_out" , token, oparg)) {replace_string (&nic->colo_compare_out, oparg); +
Stray blank line -- will try to fix it up while committing.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH V4 5/8] COLO-Proxy: Add secondary userspace colo-proxy start args
Quoted 7 lines · Wei Liu
Quoted 3 lines · Zhang Chen
Qemu need this args to start userspace colo-proxy.
Signed-off-by Zhang Chen <[email protected]>Acked-by Wei Liu <[email protected]>
Quoted 11 lines
tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) · line 519
Quoted 9 lines
tools/xl/xl_parse.c +1
-0@@ -516,6 +516,33 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)replace_string (&nic->colo_compare_sec_in, oparg); }else if (MATCH_OPTION ("colo_compare_out" , token, oparg)) {replace_string (&nic->colo_compare_out, oparg); +Stray blank line -- will try to fix it up while committing.
Actually, removing this will cause rebase error for the next patch. I will just send another patch to remove this blank line when I get around to it.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH V4 5/8] COLO-Proxy: Add secondary userspace colo-proxy start args
Quoted 17 lines · Wei Liu
Quoted 6 lines · Wei Liu
Quoted 3 lines · Zhang Chen
Qemu need this args to start userspace colo-proxy.
Signed-off-by Zhang Chen <[email protected]>Acked-by Wei Liu <[email protected]>Quoted 10 lines
tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) · line 519
Quoted 9 lines
tools/xl/xl_parse.c +1
-0@@ -516,6 +516,33 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)replace_string (&nic->colo_compare_sec_in, oparg); }else if (MATCH_OPTION ("colo_compare_out" , token, oparg)) {replace_string (&nic->colo_compare_out, oparg); +Stray blank line -- will try to fix it up while committing.
Quoted 3 lines
Actually, removing this will cause rebase error for the next patch. I will just send another patch to remove this blank line when I get around to it.
Don't need to bother you, I will send a patch for it.
Thanks
Zhang Chen
Quoted 5 lines
Wei.
.
Signature · 10 lines
Thanks Zhang Chen _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v4 6/8 COLO-Proxy: Add colo-compare notify args
In reply to Zhang ChenXen colo-frame can use the notify way communicate with qemu colo-compare.
--- tools/libxl/libxl_dm.c | 12 +++++++++--- tools/libxl/libxl_nic.c | 8 ++++++++ tools/libxl/libxl_types.idl | 4 ++++ tools/xl/xl_parse.c | 8 ++++++++ 4 files changed, 29 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c +9 -3
@@ -1323,6 +1323,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, sock_compare_sec_in_ip, sock_compare_sec_in_port); +APPEND_COLO_SOCK_SERVER (sock_compare_notify_id, + sock_compare_notify_ip, + sock_compare_notify_port); +APPEND_COLO_SOCK_SERVER (sock_redirector0_id, sock_redirector0_ip, sock_redirector0_port);
@@ -1364,13 +1368,15 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, }if (nics[i].colo_compare_pri_in && nics[i].colo_compare_sec_in && - nics[i].colo_compare_out) { + nics[i].colo_compare_out && + nics[i].colo_compare_notify_dev) {flexarray_append (dm_args,"-object" );flexarray_append (dm_args, -GCSPRINTF ("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s" , +GCSPRINTF ("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s,notify_dev=%s" , nics[i].colo_compare_pri_in, nics[i].colo_compare_sec_in, - nics[i].colo_compare_out)); + nics[i].colo_compare_out, + nics[i].colo_compare_notify_dev)); } } ioemu_nics++;
tools/libxl/libxl_nic.c +8 -0
@@ -212,6 +212,9 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,MAYBE_ADD_COLO_ARGS (sock_compare_sec_in_id);MAYBE_ADD_COLO_ARGS (sock_compare_sec_in_ip);MAYBE_ADD_COLO_ARGS (sock_compare_sec_in_port); +MAYBE_ADD_COLO_ARGS (sock_compare_notify_id); +MAYBE_ADD_COLO_ARGS (sock_compare_notify_ip); +MAYBE_ADD_COLO_ARGS (sock_compare_notify_port);MAYBE_ADD_COLO_ARGS (sock_redirector0_id);MAYBE_ADD_COLO_ARGS (sock_redirector0_ip);MAYBE_ADD_COLO_ARGS (sock_redirector0_port);
@@ -232,6 +235,7 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,MAYBE_ADD_COLO_ARGS (compare_pri_in);MAYBE_ADD_COLO_ARGS (compare_sec_in);MAYBE_ADD_COLO_ARGS (compare_out); +MAYBE_ADD_COLO_ARGS (compare_notify_dev);MAYBE_ADD_COLO_ARGS (sock_sec_redirector0_id);MAYBE_ADD_COLO_ARGS (sock_sec_redirector0_ip);
@@ -418,6 +422,9 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,CHECK_COLO_ARGS (sock_compare_sec_in_id);CHECK_COLO_ARGS (sock_compare_sec_in_ip);CHECK_COLO_ARGS (sock_compare_sec_in_port); +CHECK_COLO_ARGS (sock_compare_notify_id); +CHECK_COLO_ARGS (sock_compare_notify_ip); +CHECK_COLO_ARGS (sock_compare_notify_port);CHECK_COLO_ARGS (sock_redirector0_id);CHECK_COLO_ARGS (sock_redirector0_ip);CHECK_COLO_ARGS (sock_redirector0_port);
@@ -438,6 +445,7 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,CHECK_COLO_ARGS (compare_pri_in);CHECK_COLO_ARGS (compare_sec_in);CHECK_COLO_ARGS (compare_out); +CHECK_COLO_ARGS (compare_notify_dev);CHECK_COLO_ARGS (sock_sec_redirector0_id);CHECK_COLO_ARGS (sock_sec_redirector0_ip);CHECK_COLO_ARGS (sock_sec_redirector0_port);
tools/libxl/libxl_types.idl +4 -0
@@ -639,6 +639,9 @@ libxl_device_nic = Struct("device_nic", [ ("colo_sock_compare_sec_in_id", string), ("colo_sock_compare_sec_in_ip", string), ("colo_sock_compare_sec_in_port", string), + ("colo_sock_compare_notify_id", string), + ("colo_sock_compare_notify_ip", string), + ("colo_sock_compare_notify_port", string), ("colo_sock_redirector0_id", string), ("colo_sock_redirector0_ip", string), ("colo_sock_redirector0_port", string),
@@ -659,6 +662,7 @@ libxl_device_nic = Struct("device_nic", [ ("colo_compare_pri_in", string), ("colo_compare_sec_in", string), ("colo_compare_out", string), + ("colo_compare_notify_dev", string), ("colo_sock_sec_redirector0_id", string), ("colo_sock_sec_redirector0_ip", string), ("colo_sock_sec_redirector0_port", string),
tools/xl/xl_parse.c +8 -0
@@ -494,6 +494,12 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)replace_string (&nic->colo_sock_compare_pri_in_ip, oparg); }else if (MATCH_OPTION ("colo_sock_compare_pri_in_port" , token, oparg)) {replace_string (&nic->colo_sock_compare_pri_in_port, oparg); + }else if (MATCH_OPTION ("colo_sock_compare_notify_id" , token, oparg)) { +replace_string (&nic->colo_sock_compare_notify_id, oparg); + }else if (MATCH_OPTION ("colo_sock_compare_notify_ip" , token, oparg)) { +replace_string (&nic->colo_sock_compare_notify_ip, oparg); + }else if (MATCH_OPTION ("colo_sock_compare_notify_port" , token, oparg)) { +replace_string (&nic->colo_sock_compare_notify_port, oparg); }else if (MATCH_OPTION ("colo_filter_mirror_queue" , token, oparg)) {replace_string (&nic->colo_filter_mirror_queue, oparg); }else if (MATCH_OPTION ("colo_filter_mirror_outdev" , token, oparg)) {
@@ -516,6 +522,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)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 ("colo_compare_notify_dev" , token, oparg)) { +replace_string (&nic->colo_compare_notify_dev, oparg); }else if (MATCH_OPTION ("colo_sock_sec_redirector0_id" , token, oparg)) {replace_string (&nic->colo_sock_sec_redirector0_id, oparg);
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 6/8] COLO-Proxy: Add colo-compare notify args
Quoted 4 lines · Zhang Chen
Xen colo-frame can use the notify way communicate with qemu colo-compare.
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v4 7/8 COLO-Proxy: Use socket to get checkpoint event.
In reply to Zhang ChenWe use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Qemu colo-compare need add a API to support this(I will add this in qemu). Qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.html
--- tools/libxl/libxl_colo.h | 2 + tools/libxl/libxl_colo_proxy.c | 126 +++++++++++++++++++++++++++++++++++++-- tools/libxl/libxl_colo_restore.c | 11 ++-- tools/libxl/libxl_colo_save.c | 21 ++++--- tools/libxl/libxl_nic.c | 4 ++ tools/libxl/libxl_types.idl | 4 +- tools/xl/xl_parse.c | 4 ++ 7 files changed, 156 insertions(+), 16 deletions(-)
tools/libxl/libxl_colo.h +2 -0
@@ -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 {
tools/libxl/libxl_colo_proxy.c +122 -4
171 lines not on this page · raw message
tools/libxl/libxl_colo_restore.c +7 -4
@@ -613,7 +613,8 @@ static void colo_restore_preresume_cb(libxl__egc *egc, } } -colo_proxy_preresume (&crs->cps); +if (!crs->cps.is_userspace_proxy) +colo_proxy_preresume (&crs->cps);colo_restore_resume_vm (egc, crcs);
@@ -786,9 +787,11 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc, cds->ops = colo_restore_ops; crs->cps.ao = ao; -if (colo_proxy_setup (&crs->cps)) { -LOGD (ERROR , cds->domid,"COLO: failed to setup colo proxy for guest" ); - goto out; +if (!crs->cps.is_userspace_proxy) { +if (colo_proxy_setup (&crs->cps)) { +LOGD (ERROR , cds->domid,"COLO: failed to setup colo proxy for guest" ); + goto out; + } }if (init_device_subkind (cds))
tools/libxl/libxl_colo_save.c +14 -7
@@ -86,6 +86,7 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css)libxl__checkpoint_devices_state *const cds = &dss->cds;libxl__srm_save_autogen_callbacks *const callbacks = &dss->sws.shs.callbacks.save.a; +libxl_device_nic *nics;STATE_AO_GC (dss->ao);
@@ -110,19 +111,25 @@ 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 ()); -/* 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; cds->domid = dss->domid; cds->concrete_data = css; +/* 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 ); + +/* Use this args we can connect to qemu colo-compare */ + nics =libxl_device_nic_list (CTX , cds->domid, &cds->num_nics); + css->cps.checkpoint_host = nics->colo_checkpoint_host; + css->cps.checkpoint_port = nics->colo_checkpoint_port; + }else { + cds->device_kind_flags = (1 <<LIBXL__DEVICE_KIND_VIF ) | + (1 <<LIBXL__DEVICE_KIND_VBD ); + } + css->srs.ao = ao; css->srs.fd = css->recv_fd; css->srs.back_channel = true;
tools/libxl/libxl_nic.c +4 -0
@@ -250,6 +250,8 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,MAYBE_ADD_COLO_ARGS (filter_sec_redirector1_indev);MAYBE_ADD_COLO_ARGS (filter_sec_redirector1_outdev);MAYBE_ADD_COLO_ARGS (filter_sec_rewriter0_queue); +MAYBE_ADD_COLO_ARGS (checkpoint_host); +MAYBE_ADD_COLO_ARGS (checkpoint_port);#undef MAYBE_ADD_COLO_ARGS
@@ -459,6 +461,8 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,CHECK_COLO_ARGS (filter_sec_redirector1_indev);CHECK_COLO_ARGS (filter_sec_redirector1_outdev);CHECK_COLO_ARGS (filter_sec_rewriter0_queue); +CHECK_COLO_ARGS (checkpoint_host); +CHECK_COLO_ARGS (checkpoint_port);#undef CHECK_COLO_ARGS
tools/libxl/libxl_types.idl +3 -1
@@ -675,7 +675,9 @@ libxl_device_nic = Struct("device_nic", [ ("colo_filter_sec_redirector1_queue", string), ("colo_filter_sec_redirector1_indev", string), ("colo_filter_sec_redirector1_outdev", string), - ("colo_filter_sec_rewriter0_queue", string) + ("colo_filter_sec_rewriter0_queue", string), + ("colo_checkpoint_host", string), + ("colo_checkpoint_port", string) ]) libxl_device_pci = Struct("device_pci", [
tools/xl/xl_parse.c +4 -0
@@ -551,6 +551,10 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)replace_string (&nic->colo_filter_sec_redirector1_outdev, oparg); }else if (MATCH_OPTION ("colo_filter_sec_rewriter0_queue" , token, oparg)) {replace_string (&nic->colo_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 if (MATCH_OPTION ("devid" , token, oparg)) {
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 7/8] COLO-Proxy: Use socket to get checkpoint event.
Quoted 7 lines · Zhang Chen
We use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Qemu colo-compare need add a API to support this(I will add this in qemu). Qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.htmlSigned-off-by Zhang Chen <[email protected]>
But see below.
Quoted 23 lines
tools/libxl/libxl_colo_proxy.c +13
-2@@ -289,8 +393,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,* event. */ if (cps->is_userspace_proxy) { -usleep (timeout_us); -return 0 ; + ret =colo_userspace_proxy_recv (cps, recvbuff, timeout_us); +if (ret <=0 ) { + ret =0 ; + goto out1; + } + +if (!strcmp (recvbuff,"DO_CHECKPOINT" )) { + ret =1 ; + }else { +LOGD (ERROR , ao->domid,"receive qemu colo-compare checkpoint error" ); + ret =0 ; + } + goto out1; } size =colo_proxy_recv (cps, &buff, timeout_us);
tools/libxl/libxl_colo_proxy.c int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, · line 437
Quoted 5 lines
tools/libxl/libxl_colo_proxy.c +2
-0@@ -318,4 +433,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out:free (buff);return ret; + +out1:
Perhaps try to come up with a better name than out1? Subsequent patch is welcome.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH V4 7/8] COLO-Proxy: Use socket to get checkpoint event.
Quoted 33 lines · Wei Liu
Quoted 7 lines · Zhang Chen
We use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Qemu colo-compare need add a API to support this(I will add this in qemu). Qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.htmlSigned-off-by Zhang Chen <[email protected]>Acked-by Wei Liu <[email protected]>But see below.
Quoted 21 lines
tools/libxl/libxl_colo_proxy.c +13
-2@@ -289,8 +393,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,* event. */ if (cps->is_userspace_proxy) { -usleep (timeout_us); -return 0 ; + ret =colo_userspace_proxy_recv (cps, recvbuff, timeout_us); +if (ret <=0 ) { + ret =0 ; + goto out1; + } + +if (!strcmp (recvbuff,"DO_CHECKPOINT" )) { + ret =1 ; + }else { +LOGD (ERROR , ao->domid,"receive qemu colo-compare checkpoint error" ); + ret =0 ; + } + goto out1; }
Quoted 10 lines
tools/libxl/libxl_colo_proxy.c int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, · line 437
Quoted 7 lines
tools/libxl/libxl_colo_proxy.c +2
-0size =colo_proxy_recv (cps, &buff, timeout_us);@@ -318,4 +433,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out:free (buff);return ret; + +out1:Perhaps try to come up with a better name than out1? Subsequent patch is welcome.
How about change 'out1' to 'out_userspace_proxy' ? If OK, I will send a patch for it.
Thanks
Zhang Chen
Quoted 2 lines
.
Signature · 10 lines
Thanks Zhang Chen _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 7/8] COLO-Proxy: Use socket to get checkpoint event.
Quoted 46 lines · Zhang Chen
Quoted 33 lines · Wei Liu
Quoted 7 lines · Zhang Chen
We use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Qemu colo-compare need add a API to support this(I will add this in qemu). Qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.htmlSigned-off-by Zhang Chen <[email protected]>Acked-by Wei Liu <[email protected]>But see below.
Quoted 21 lines
(quoted diff) +13
-2@@ -289,8 +393,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, * event. */ if (cps->is_userspace_proxy) { - usleep(timeout_us); - return 0; + ret = colo_userspace_proxy_recv(cps, recvbuff, timeout_us); + if (ret <= 0) { + ret = 0; + goto out1; + } + + if (!strcmp(recvbuff, "DO_CHECKPOINT")) { + ret = 1; + } else { + LOGD(ERROR, ao->domid, "receive qemu colo-compare checkpoint error"); + ret = 0; + } + goto out1; } size = colo_proxy_recv(cps, &buff, timeout_us);Quoted 9 lines
Review int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, · line 437
Quoted 6 lines
(quoted diff) +2
-0@@ -318,4 +433,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out: free(buff); return ret; + +out1:Perhaps try to come up with a better name than out1? Subsequent patch is welcome.
Quoted 3 lines
How about change 'out1' to '
out_userspace_proxy' ? If OK, I will send a patch for it.
How about the following patch instead? Compile test only.
In general I would like code to stick with coding style.
--->8---
From 0a87defaad529c02babe24055d5782b74d3a38e3 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Wed, 15 Mar 2017 10:50:19 +0000
Subject: [PATCH] libxl/colo: unified exit path for colo_proxy_checkpoint
Slightly refactor the code to have only one exit path for the said function.
--- tools/libxl/libxl_colo_proxy.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
tools/libxl/libxl_colo_proxy.c +7 -8
@@ -375,7 +375,7 @@ typedef struct colo_msg {int colo_proxy_checkpoint (libxl__colo_proxy_state *cps,unsigned int timeout_us) { -uint8_t *buff; +uint8_t *buff =NULL ;int64_t size;struct nlmsghdr *h;struct colo_msg *m;
@@ -396,7 +396,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, ret =colo_userspace_proxy_recv (cps, recvbuff, timeout_us);if (ret <=0 ) { ret =0 ; - goto out1; + goto out; }if (!strcmp (recvbuff,"DO_CHECKPOINT" )) {
@@ -405,14 +405,16 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,LOGD (ERROR , ao->domid,"receive qemu colo-compare checkpoint error" ); ret =0 ; } - goto out1; + goto out; } size =colo_proxy_recv (cps, &buff, timeout_us);/* timeout, return no checkpoint message. */ -if (size <=0 ) -return 0 ; +if (size <=0 ) { + ret =0 ; + goto out; + } h = (struct nlmsghdr *) buff;
@@ -433,7 +435,4 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out:free (buff);return ret; - -out1: -return ret; }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Zhang Chen
Acked-byRe: [PATCH V4 7/8] COLO-Proxy: Use socket to get checkpoint event.
Quoted 54 lines · Wei Liu
Quoted 44 lines · Zhang Chen
Quoted 33 lines · Wei Liu
Quoted 7 lines · Zhang Chen
We use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Qemu colo-compare need add a API to support this(I will add this in qemu). Qemu side patch:https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.htmlSigned-off-by Zhang Chen <[email protected]>Acked-by Wei Liu <[email protected]>But see below.
Quoted 21 lines
(quoted diff) +13
-2@@ -289,8 +393,19 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, * event. */ if (cps->is_userspace_proxy) { - usleep(timeout_us); - return 0; + ret = colo_userspace_proxy_recv(cps, recvbuff, timeout_us); + if (ret <= 0) { + ret = 0; + goto out1; + } + + if (!strcmp(recvbuff, "DO_CHECKPOINT")) { + ret = 1; + } else { + LOGD(ERROR, ao->domid, "receive qemu colo-compare checkpoint error"); + ret = 0; + } + goto out1; } size = colo_proxy_recv(cps, &buff, timeout_us);Quoted 9 lines
tools/libxl/libxl_colo_proxy.c int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, · line 437
Quoted 6 lines
tools/libxl/libxl_colo_proxy.c +2
-0@@ -318,4 +433,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out:free (buff);return ret; + +out1:Perhaps try to come up with a better name than out1? Subsequent patch is welcome.
Quoted 3 lines
How about change 'out1' to '
out_userspace_proxy' ? If OK, I will send a patch for it.How about the following patch instead? Compile test only.
In general I would like code to stick with coding style.
--->8---
Quoted 1 line
From
0a87defaad529c02babe24055d5782b74d3a38e3Mon Sep 17 00:00:00 2001
Quoted 8 lines
From: Wei Liu <[email protected]>
Date: Wed, 15 Mar 2017 10:50:19 +0000
Subject: [PATCH] libxl/colo: unified exit path forcolo_proxy_checkpointSlightly refactor the code to have only one exit path for the said function.
Signed-off-by Wei Liu <[email protected]>
Thanks
Zhang Chen
Quoted 55 lines
--- tools/libxl/libxl_colo_proxy.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)tools/libxl/libxl_colo_proxy.c +7
-8@@ -375,7 +375,7 @@ typedef struct colo_msg {int colo_proxy_checkpoint (libxl__colo_proxy_state *cps,unsigned int timeout_us) { -uint8_t *buff; +uint8_t *buff =NULL ;int64_t size;struct nlmsghdr *h;struct colo_msg *m;@@ -396,7 +396,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, ret =colo_userspace_proxy_recv (cps, recvbuff, timeout_us);if (ret <=0 ) { ret =0 ; - goto out1; + goto out; }if (!strcmp (recvbuff,"DO_CHECKPOINT" )) {@@ -405,14 +405,16 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,LOGD (ERROR , ao->domid,"receive qemu colo-compare checkpoint error" ); ret =0 ; } - goto out1; + goto out; } size =colo_proxy_recv (cps, &buff, timeout_us);/* timeout, return no checkpoint message. */ -if (size <=0 ) -return 0 ; +if (size <=0 ) { + ret =0 ; + goto out; + } h = (struct nlmsghdr *) buff;@@ -433,7 +435,4 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out:free (buff);return ret; - -out1: -return ret; }
Signature · 10 lines
Thanks Zhang Chen _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v4 8/8 COLO-proxy: Add colo_userspace_proxy macro
In reply to Zhang Chen--- tools/libxl/libxl.h | 6 ++++++ 1 file changed, 6 insertions(+)
tools/libxl/libxl.h +6 -0
@@ -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 */
Signature · 9 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH V4 8/8] COLO-proxy: Add colo_userspace_proxy macro
Quoted 1 line · Zhang Chen
Signed-off-by Zhang Chen <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Zhang Chen
Because of some reason, We no longer support COLO kernel proxy.
However the #7 talks about kernel colo proxy? Is this description out-dated?
Quoted 1 line
V4:
One usually adds these comments to the patches. That is right after the '---' you say:
v4: New patch
(for the new patches)
Or for the older patches (like #7):
v4: Fix typo.
Fix 'some bug' (perhaps be specific).
Quoted 9 lines
- Because the origin 3/7 has been merged,
remove it in this series.
- Add new patch "COLO-Proxy: Add colo-compare notify args" to support qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.html- Add
colo_userspace_proxymacro as a separate patch.
- Add some comments about COLO and fix some typo in patch 2/7.
- Fix some bug and typo in patch 7/7.
But the subject is 0/8? So it can't be 7/7. Did you mean 7/8? or 8/8/?
Quoted 1 line
- Rebase codes on upstream Xen.
Thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Zhang Chen
Because of some reason, We no longer support COLO kernel proxy.
However the #7 talks about kernel colo proxy? Is this description out-dated?
In patch 7/8, the comments:
We use kernel colo proxy's way to get the checkpoint event from qemu colo-compare.
Here, I mean we use same method communicate with qemu colo-compare like colo kernel proxy do, we both use the socket.
Quoted 4 lines
Quoted 1 line
V4:
One usually adds these comments to the patches. That is right after the '---' you say:
Quoted 8 lines
v4: New patch
(for the new patches)
Or for the older patches (like #7):
v4: Fix typo.
Fix 'some bug' (perhaps be specific).
OK, I will add version comments in patches next version.
Quoted 7 lines
Quoted 7 lines
- Because the origin 3/7 has been merged,
remove it in this series.
- Add new patch "COLO-Proxy: Add colo-compare notify args" to support qemu side patch:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg07265.html
Quoted 5 lines
Quoted 3 lines
- Add
colo_userspace_proxymacro as a separate patch.
- Add some comments about COLO and fix some typo in patch 2/7.
- Fix some bug and typo in patch 7/7.But the subject is 0/8? So it can't be 7/7. Did you mean 7/8? or 8/8/?
Sorry, s/"7/7"/"7/8", s/"2/7"/"2/8".
Thanks
Zhang Chen
Quoted 7 lines
Quoted 2 lines
- Rebase codes on upstream Xen.
Thanks!
.
Signature · 10 lines
Thanks Zhang Chen _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel