debuggers.hg
changeset 22833:003acf02d416
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author | Ian Jackson <ian.jackson@eu.citrix.com> |
---|---|
date | Thu Jan 20 17:04:06 2011 +0000 (2011-01-20) |
parents | 6ee4b87d1863 |
children | 5852612cd4c4 e9277ab43947 |
files | tools/libxl/libxl.c |
line diff
1.1 --- a/tools/libxl/libxl.c Thu Jan 20 16:45:54 2011 +0000 1.2 +++ b/tools/libxl/libxl.c Thu Jan 20 17:04:06 2011 +0000 1.3 @@ -506,34 +506,26 @@ int libxl_domain_shutdown(libxl_ctx *ctx 1.4 return ERROR_FAIL; 1.5 } 1.6 1.7 - shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path); 1.8 - 1.9 - xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req])); 1.10 if (libxl__domain_is_hvm(ctx,domid)) { 1.11 - unsigned long acpi_s_state = 0; 1.12 unsigned long pvdriver = 0; 1.13 int ret; 1.14 - ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, &acpi_s_state); 1.15 - if (ret<0) { 1.16 - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting ACPI S-state"); 1.17 - libxl__free_all(&gc); 1.18 - return ERROR_FAIL; 1.19 - } 1.20 ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver); 1.21 if (ret<0) { 1.22 LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting HVM callback IRQ"); 1.23 libxl__free_all(&gc); 1.24 return ERROR_FAIL; 1.25 } 1.26 - if (!pvdriver || acpi_s_state != 0) { 1.27 - ret = xc_domain_shutdown(ctx->xch, domid, req); 1.28 - if (ret<0) { 1.29 - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain"); 1.30 - libxl__free_all(&gc); 1.31 - return ERROR_FAIL; 1.32 - } 1.33 - } 1.34 + if (!pvdriver) { 1.35 + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "HVM domain without PV drivers:" 1.36 + " graceful shutdown not possible, use destroy"); 1.37 + libxl__free_all(&gc); 1.38 + return ERROR_FAIL; 1.39 + } 1.40 } 1.41 + 1.42 + shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path); 1.43 + xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req])); 1.44 + 1.45 libxl__free_all(&gc); 1.46 return 0; 1.47 }