[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC v3 05/12] Migration with Local Disks Mirroring: QEMU process is started with '-incoming defer' option
For the migration with local disks mirroring scenario, the QEMU process is started before the virtual RAM is transferred to the destination node so that the QEMU embedded NBD server and disks mirroring jobs can be started. After the virtual RAM and QEMU state are transferred, the QEMU process will be resumed using the QMP 'migrate-incoming' command. When qemu-xen is started with '-incoming defer' option the initial state of the instance will be 'inmigrate'. Thus, when either 'running' or 'inmigrate' are read from xenstore the spawn detach is carried out. Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx> --- tools/libxl/libxl_dm.c | 20 ++++++++++++++------ tools/libxl/libxl_internal.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index a2ea95a..e12e015 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -940,7 +940,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, const libxl_domain_config *guest_config, char ***args, char ***envs, const libxl__domain_build_state *state, - int *dm_state_fd) + int *dm_state_fd, int mirror_disks) { const libxl_domain_create_info *c_info = &guest_config->c_info; const libxl_domain_build_info *b_info = &guest_config->b_info; @@ -1431,6 +1431,12 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, "-incoming"); flexarray_append(dm_args, GCSPRINTF("fd:%d",*dm_state_fd)); } + + if (mirror_disks) { + flexarray_append(dm_args, "-incoming"); + flexarray_append(dm_args, "defer"); + } + for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++) flexarray_append(dm_args, b_info->extra[i]); @@ -1728,7 +1734,7 @@ static int libxl__build_device_model_args(libxl__gc *gc, const libxl_domain_config *guest_config, char ***args, char ***envs, const libxl__domain_build_state *state, - int *dm_state_fd) + int *dm_state_fd, int mirror_disks) /* dm_state_fd may be NULL iff caller knows we are using old stubdom * and therefore will be passing a filename rather than a fd. */ { @@ -1744,7 +1750,8 @@ static int libxl__build_device_model_args(libxl__gc *gc, return libxl__build_device_model_args_new(gc, dm, guest_domid, guest_config, args, envs, - state, dm_state_fd); + state, dm_state_fd, + mirror_disks); default: LOGED(ERROR, guest_domid, "unknown device model version %d", guest_config->b_info.device_model_version); @@ -1964,7 +1971,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) ret = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid, guest_config, &args, NULL, - d_state, NULL); + d_state, NULL, 0); if (ret) { ret = ERROR_FAIL; goto out; @@ -2267,7 +2274,8 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) } rc = libxl__build_device_model_args(gc, dm, domid, guest_config, &args, &envs, state, - &dm_state_fd); + &dm_state_fd, + dmss->mirror_disks); if (rc) goto out; @@ -2397,7 +2405,7 @@ static void device_model_confirm(libxl__egc *egc, libxl__spawn_state *spawn, if (!xsdata) return; - if (strcmp(xsdata, "running")) + if (strcmp(xsdata, "running") && strcmp(xsdata, "inmigrate")) return; libxl__spawn_initiate_detach(gc, spawn); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4d7679e..e8a4dc2 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3711,6 +3711,7 @@ struct libxl__dm_spawn_state { libxl__spawn_state spawn; /* filled in by user, must remain valid: */ uint32_t guest_domid; /* domain being served */ + int mirror_disks; libxl_domain_config *guest_config; libxl__domain_build_state *build_state; /* relates to guest_domid */ libxl__dm_spawn_cb *callback; -- 2.3.2 (Apple Git-55) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |