[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: Make domain_shutdown fail if graceful not possible
# HG changeset patch # User Ian Jackson <ian.jackson@xxxxxxxxxxxxx> # Date 1295543046 0 # Node ID 003acf02d416d657f750b7a7748fa8c5a932222c # Parent 6ee4b87d1863433cd8bc45f8231659fa699047bb libxl: Make domain_shutdown fail if graceful not possible Currently "xl shutdown" (like "xm shutdown") is not capable of doing the proper ACPI negotiation with an HVM no-pv-drivers guest which would be necessary for a graceful shutdown. Instead (following the ill-advised lead of "xm shutdown") it simply shoots the guest in the head. This patch changes the behaviour so that "xl shutdown" fails if the domain cannot be shut down gracefully for this reason and suggests in the error message using destroy instead. Also, check whether the PV shutdown protocol is available before we try to use it. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl.c | 30 +++++++++++------------------- 1 files changed, 11 insertions(+), 19 deletions(-) diff -r 6ee4b87d1863 -r 003acf02d416 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Jan 20 16:45:54 2011 +0000 +++ b/tools/libxl/libxl.c Thu Jan 20 17:04:06 2011 +0000 @@ -506,34 +506,26 @@ int libxl_domain_shutdown(libxl_ctx *ctx return ERROR_FAIL; } - shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path); - - xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req])); if (libxl__domain_is_hvm(ctx,domid)) { - unsigned long acpi_s_state = 0; unsigned long pvdriver = 0; int ret; - ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, &acpi_s_state); - if (ret<0) { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting ACPI S-state"); - libxl__free_all(&gc); - return ERROR_FAIL; - } ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver); if (ret<0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting HVM callback IRQ"); libxl__free_all(&gc); return ERROR_FAIL; } - if (!pvdriver || acpi_s_state != 0) { - ret = xc_domain_shutdown(ctx->xch, domid, req); - if (ret<0) { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain"); - libxl__free_all(&gc); - return ERROR_FAIL; - } - } - } + if (!pvdriver) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "HVM domain without PV drivers:" + " graceful shutdown not possible, use destroy"); + libxl__free_all(&gc); + return ERROR_FAIL; + } + } + + shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path); + xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req])); + libxl__free_all(&gc); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |