[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1 COLO Pre 06/12] tools/libxl: Update libxl__domain_unpause() to support qemu-xen
Currently, libxl__domain_unpause() only supports qemu-xen-traditional. Update it to support qemu-xen. Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> --- tools/libxl/libxl.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 98f2a4f..b960984 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -966,10 +966,37 @@ out: return AO_INPROGRESS; } -int libxl__domain_unpause(libxl__gc *gc, uint32_t domid) +static int libxl__domain_unpause_device_model(libxl__gc *gc, uint32_t domid) { char *path; char *state; + + switch (libxl__device_model_version_running(gc, domid)) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { + uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid); + + path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); + state = libxl__xs_read(gc, XBT_NULL, path); + if (state != NULL && !strcmp(state, "paused")) { + libxl__qemu_traditional_cmd(gc, domid, "continue"); + libxl__wait_for_device_model_deprecated(gc, domid, "running", + NULL, NULL, NULL); + } + break; + } + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + if (libxl__qmp_resume(gc, domid)) + return ERROR_FAIL; + break; + default: + return ERROR_INVAL; + } + + return 0; +} + +int libxl__domain_unpause(libxl__gc *gc, uint32_t domid) +{ int ret, rc = 0; libxl_domain_type type = libxl__domain_type(gc, domid); @@ -979,14 +1006,11 @@ int libxl__domain_unpause(libxl__gc *gc, uint32_t domid) } if (type == LIBXL_DOMAIN_TYPE_HVM) { - uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid); - - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); - state = libxl__xs_read(gc, XBT_NULL, path); - if (state != NULL && !strcmp(state, "paused")) { - libxl__qemu_traditional_cmd(gc, domid, "continue"); - libxl__wait_for_device_model_deprecated(gc, domid, "running", - NULL, NULL, NULL); + rc = libxl__domain_unpause_device_model(gc, domid); + if (rc < 0) { + LOG(ERROR, "failed to unpause device model for domain %u:%d", + domid, rc); + goto out; } } -- 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 |