@@ -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;
@@ -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;
@@ -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",[
@@ -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 */
@@ -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");
}
}
@@ -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,
In this patch we add a function to close COLO kernel Proxy on secondary side. Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> --- 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(-)