[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tools/xl: show shutdown reason code, improve xl list heading
# HG changeset patch # User Ian Jackson <ian.jackson@xxxxxxxxxxxxx> # Date 1290540974 0 # Node ID e5c4e925e1bd15baeadc0817dcceb5fff54b8a74 # Parent 0c2b7a185ad130060b36473ea83b7610c8fb23e0 tools/xl: show shutdown reason code, improve xl list heading Previously, xl list would not reveal the shutdown reason code unless it was SHUTDOWN_crashed. This is unfortunate; it makes it hard for scripts which use xl to tell what's going on. In this patch: * xl list shows the reason code as a single letter if it is any of the defined values from sched.h: - poweroff or domain not shut down r reboot s suspend c crashed w watchdog This is not 100% backward-compatible with xm but I think it's a justifiable improvement. It would be nice to make the same change to xm. * xl list -v shows the full numeric reason code in hex, or "-" if the domain is not shut down. * xl list -v has column headings for the UUID and numeric reason code. The heading for the reason code overlaps with the UUID a bit. These headings are intended for human readers; scripts can parse the output by breaking on whitespace. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff -r 0c2b7a185ad1 -r e5c4e925e1bd tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Nov 23 19:35:09 2010 +0000 +++ b/tools/libxl/xl_cmdimpl.c Tue Nov 23 19:36:14 2010 +0000 @@ -2484,11 +2484,16 @@ static void list_domains(int verbose, co static void list_domains(int verbose, const libxl_dominfo *info, int nb_domain) { int i; - - printf("Name ID Mem VCPUs\tState\tTime(s)\n"); + static const char shutdown_reason_letters[]= "-rscw"; + + printf("Name ID Mem VCPUs\tState\tTime(s)"); + if (verbose) printf(" UUID Reason-Code"); + printf("\n"); for (i = 0; i < nb_domain; i++) { char *domname; + unsigned shutdown_reason; domname = libxl_domid_to_name(&ctx, info[i].domid); + shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0; printf("%-40s %5d %5lu %5d %c%c%c%c%c%c %8.1f", domname, info[i].domid, @@ -2498,12 +2503,17 @@ static void list_domains(int verbose, co info[i].blocked ? 'b' : '-', info[i].paused ? 'p' : '-', info[i].shutdown ? 's' : '-', - info[i].shutdown_reason == SHUTDOWN_crash ? 'c' : '-', + (shutdown_reason >= 0 && + shutdown_reason < sizeof(shutdown_reason_letters)-1 + ? shutdown_reason_letters[shutdown_reason] : '?'), info[i].dying ? 'd' : '-', ((float)info[i].cpu_time / 1e9)); free(domname); - if (verbose) + if (verbose) { printf(" " LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info[i].uuid)); + if (info[i].shutdown) printf(" %8x", shutdown_reason); + else printf(" %8s", "-"); + } putchar('\n'); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |