[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6 COLO 15/15] cmdline switches and config vars to control colo-proxy
Add cmdline switches to 'xl migrate-receive' command to specify a domain-specific hotplug script to setup COLO proxy. Add a new config var 'colo.default.agentscript' to xl.conf, that allows the user to override the default global script used to setup COLO proxy. Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- docs/man/xl.conf.pod.5 | 6 ++++++ docs/man/xl.pod.1 | 1 - tools/libxl/libxl.c | 6 ++++++ tools/libxl/libxl_create.c | 14 +++++++++++-- tools/libxl/libxl_types.idl | 1 + tools/libxl/xl.c | 3 +++ tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 49 ++++++++++++++++++++++++++++++++++----------- 8 files changed, 66 insertions(+), 15 deletions(-) diff --git a/docs/man/xl.conf.pod.5 b/docs/man/xl.conf.pod.5 index 8ae19bb..8f7fd28 100644 --- a/docs/man/xl.conf.pod.5 +++ b/docs/man/xl.conf.pod.5 @@ -111,6 +111,12 @@ Configures the default script used by Remus to setup network buffering. Default: C</etc/xen/scripts/remus-netbuf-setup> +=item B<colo.default.proxyscript="PATH"> + +Configures the default script used by COLO to setup colo-proxy. + +Default: C</etc/xen/scripts/colo-proxy-setup> + =item B<output_format="json|sxp"> Configures the default output format used by xl when printing "machine diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index 1c2ee24..8b425b5 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -454,7 +454,6 @@ N.B: Remus support in xl is still in experimental (proof-of-concept) phase. Disk replication support is limited to DRBD disks. COLO support in xl is still in experimental (proof-of-concept) phase. - There is no support for network at the moment. B<OPTIONS> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 4a5957c..224b54d 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3375,6 +3375,11 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid, flexarray_append(back, nic->ifname); } + if (nic->forwarddev) { + flexarray_append(back, "forwarddev"); + flexarray_append(back, nic->forwarddev); + } + flexarray_append(back, "mac"); flexarray_append(back,libxl__sprintf(gc, LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac))); @@ -3498,6 +3503,7 @@ static int libxl__device_nic_from_xs_be(libxl__gc *gc, nic->ip = READ_BACKEND(NOGC, "ip"); nic->bridge = READ_BACKEND(NOGC, "bridge"); nic->script = READ_BACKEND(NOGC, "script"); + nic->forwarddev = READ_BACKEND(NOGC, "forwarddev"); /* vif_ioemu nics use the same xenstore entries as vif interfaces */ tmp = READ_BACKEND(gc, "type"); diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 17d0d18..597a64c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1168,6 +1168,11 @@ static void domcreate_bootloader_done(libxl__egc *egc, crs->superpages = superpages; crs->pae = pae; crs->callback = libxl__colo_restore_setup_done; + if (dcs->colo_proxy_script) + crs->colo_proxy_script = libxl__strdup(gc, dcs->colo_proxy_script); + else + crs->colo_proxy_script = GCSPRINTF("%s/colo-proxy-setup", + libxl__xen_script_dir_path()); libxl__colo_restore_setup(egc, crs); } else libxl__xc_domain_restore(egc, dcs, @@ -1692,6 +1697,7 @@ static void domain_create_cb(libxl__egc *egc, static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config, uint32_t *domid, int restore_fd, int send_fd, int checkpointed_stream, + const char *colo_proxy_script, const libxl_asyncop_how *ao_how, const libxl_asyncprogress_how *aop_console_how) { @@ -1707,6 +1713,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config, cdcs->dcs.send_fd = send_fd; cdcs->dcs.callback = domain_create_cb; cdcs->dcs.checkpointed_stream = checkpointed_stream; + cdcs->dcs.colo_proxy_script = colo_proxy_script; libxl__ao_progress_gethow(&cdcs->dcs.aop_console_how, aop_console_how); cdcs->domid_out = domid; @@ -1750,7 +1757,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, const libxl_asyncprogress_how *aop_console_how) { unset_disk_colo_restore(d_config); - return do_domain_create(ctx, d_config, domid, -1, -1, 0, + return do_domain_create(ctx, d_config, domid, -1, -1, 0, NULL, ao_how, aop_console_how); } @@ -1761,16 +1768,19 @@ int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, const libxl_asyncprogress_how *aop_console_how) { int send_fd = -1; + char *colo_proxy_script = NULL; if (params->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_COLO) { send_fd = params->send_fd; + colo_proxy_script = params->colo_proxy_script; set_disk_colo_restore(d_config); } else { unset_disk_colo_restore(d_config); } return do_domain_create(ctx, d_config, domid, restore_fd, send_fd, - params->checkpointed_stream, ao_how, aop_console_how); + params->checkpointed_stream, colo_proxy_script, + ao_how, aop_console_how); } /* diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 4a14ce1..fe15123 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -353,6 +353,7 @@ libxl_domain_create_info = Struct("domain_create_info",[ libxl_domain_restore_params = Struct("domain_restore_params", [ ("checkpointed_stream", integer), ("send_fd", integer), + ("colo_proxy_script", string), ]) libxl_domain_sched_params = Struct("domain_sched_params",[ diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index f014306..f44f04f 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -45,6 +45,7 @@ char *default_bridge = NULL; char *default_gatewaydev = NULL; char *default_vifbackend = NULL; char *default_remus_netbufscript = NULL; +char *default_colo_proxy_script = NULL; enum output_format default_output_format = OUTPUT_FORMAT_JSON; int claim_mode = 1; bool progress_use_cr = 0; @@ -179,6 +180,8 @@ static void parse_global_config(const char *configfile, xlu_cfg_replace_string (config, "remus.default.netbufscript", &default_remus_netbufscript, 0); + xlu_cfg_replace_string (config, "colo.default.proxyscript", + &default_colo_proxy_script, 0); xlu_cfg_destroy(config); } diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index 5bc138c..33f25d1 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -178,6 +178,7 @@ extern char *default_bridge; extern char *default_gatewaydev; extern char *default_vifbackend; extern char *default_remus_netbufscript; +extern char *default_colo_proxy_script; extern char *blkdev_start; enum output_format { diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 4bbadd3..41fa1e9 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -153,6 +153,7 @@ struct domain_create { const char *config_file; const char *extra_config; /* extra config string */ const char *restore_file; + char *colo_proxy_script; int migrate_fd; /* -1 means none */ int send_fd; /* -1 means none */ char **migration_domname_r; /* from malloc */ @@ -982,6 +983,8 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to replace_string(&nic->model, oparg); } else if (MATCH_OPTION("rate", token, oparg)) { parse_vif_rate(config, oparg, nic); + } else if (MATCH_OPTION("forwarddev", token, oparg)) { + replace_string(&nic->forwarddev, oparg); } else if (MATCH_OPTION("accel", token, oparg)) { fprintf(stderr, "the accel parameter for vifs is currently not supported\n"); } else { @@ -2727,6 +2730,7 @@ start: params.checkpointed_stream = dom_info->checkpointed_stream; params.send_fd = send_fd; + params.colo_proxy_script = dom_info->colo_proxy_script; ret = libxl_domain_create_restore(ctx, &d_config, &domid, restore_fd, ¶ms, @@ -4246,7 +4250,8 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, } static void migrate_receive(int debug, int daemonize, int monitor, - int send_fd, int recv_fd, int remus) + int send_fd, int recv_fd, int remus, + char *colo_proxy_script) { uint32_t domid; int rc, rc2; @@ -4273,6 +4278,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, dom_info.send_fd = send_fd; dom_info.migration_domname_r = &migration_domname; dom_info.checkpointed_stream = remus; + dom_info.colo_proxy_script = colo_proxy_script; if (remus == LIBXL_CHECKPOINTED_STREAM_COLO) /* COLO uses stdout to send control message to master */ dom_info.quiet = 1; @@ -4467,8 +4473,9 @@ int main_migrate_receive(int argc, char **argv) { int debug = 0, daemonize = 1, monitor = 1, remus = 0; int opt; + char *script = NULL; - SWITCH_FOREACH_OPT(opt, "Fedrc", NULL, "migrate-receive", 0) { + SWITCH_FOREACH_OPT(opt, "Fedrcn:", NULL, "migrate-receive", 0) { case 'F': daemonize = 0; break; @@ -4484,6 +4491,8 @@ int main_migrate_receive(int argc, char **argv) break; case 'c': remus = LIBXL_CHECKPOINTED_STREAM_COLO; + case 'n': + script = optarg; } if (argc-optind != 0) { @@ -4492,7 +4501,7 @@ int main_migrate_receive(int argc, char **argv) } migrate_receive(debug, daemonize, monitor, STDOUT_FILENO, STDIN_FILENO, - remus); + remus, script); return 0; } @@ -8018,8 +8027,10 @@ int main_remus(int argc, char **argv) if (!interval) r_info.interval = 0; - if (r_info.interval || libxl_defbool_val(r_info.blackhole)) { - perror("option -c is conflict with -i or -b"); + if (r_info.interval || libxl_defbool_val(r_info.blackhole) || + !libxl_defbool_is_default(r_info.netbuf) || + !libxl_defbool_is_default(r_info.diskbuf)) { + perror("option -c is conflict with -i, -d, -n or -b"); exit(-1); } @@ -8029,8 +8040,12 @@ int main_remus(int argc, char **argv) } } - if (!r_info.netbufscript) - r_info.netbufscript = default_remus_netbufscript; + if (!r_info.netbufscript) { + if (libxl_defbool_val(r_info.colo)) + r_info.netbufscript = default_colo_proxy_script; + else + r_info.netbufscript = default_remus_netbufscript; + } if (libxl_defbool_val(r_info.blackhole)) { send_fd = open("/dev/null", O_RDWR, 0644); @@ -8043,11 +8058,21 @@ int main_remus(int argc, char **argv) if (!ssh_command[0]) { rune = host; } else { - if (asprintf(&rune, "exec %s %s xl migrate-receive %s %s", - ssh_command, host, - libxl_defbool_val(r_info.colo) ? "-c" : "-r", - daemonize ? "" : " -e") < 0) - return 1; + if (!libxl_defbool_val(r_info.colo)) { + if (asprintf(&rune, "exec %s %s xl migrate-receive %s %s", + ssh_command, host, + "-r", + daemonize ? "" : " -e") < 0) + return 1; + } else { + if (asprintf(&rune, "exec %s %s xl migrate-receive %s %s %s %s", + ssh_command, host, + "-c", + r_info.netbufscript ? "-n" : "", + r_info.netbufscript ? r_info.netbufscript : "", + daemonize ? "" : " -e") < 0) + return 1; + } } save_domain_core_begin(domid, NULL, &config_data, &config_len); -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |