From: Dario Faggioli Date: Fri, 13 Mar 2015 11:09:13 +0000 (+0100) Subject: xl: add -c/--cpupool option to `xl list' X-Git-Tag: 4.6.0-rc1~938 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9185dec0a42e0f5c297e721e5b6073d3ac2850fe;p=xen.git xl: add -c/--cpupool option to `xl list' which, if provided, makes the command print a column with the name of the cpupool of the listed domain(s). Signed-off-by: Dario Faggioli Cc: Ian Campbell Cc: Ian Jackson Cc: Stefano Stabellini Cc: Wei Liu Cc: Juergen Gross Acked-by: Wei Liu --- diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index b0162727a9..5da9b15dea 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -304,6 +304,10 @@ Also prints the security labels. Also prints the domain UUIDs, the shutdown reason and security labels. +=item B<-c>, <--cpupool> + +Also prints the cpupool the domain belong to. + =item B<-n>, <--numa> Also prints the domain NUMA node affinity. diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index e910b780ba..fe1d3eca9a 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3699,7 +3699,7 @@ static void print_bitmap(uint8_t *map, int maplen, FILE *stream) } static void list_domains(bool verbose, bool context, bool claim, bool numa, - const libxl_dominfo *info, int nb_domain) + bool cpupool, const libxl_dominfo *info, int nb_domain) { int i; static const char shutdown_reason_letters[]= "-rscw"; @@ -3713,6 +3713,7 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa, if (verbose) printf(" UUID Reason-Code\tSecurity Label"); if (context && !verbose) printf(" Security Label"); if (claim) printf(" Claimed"); + if (cpupool) printf(" Cpupool"); if (numa) { if (libxl_node_bitmap_alloc(ctx, &nodemap, 0)) { fprintf(stderr, "libxl_node_bitmap_alloc_failed.\n"); @@ -3757,6 +3758,11 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa, printf(" %5lu", (unsigned long)info[i].outstanding_memkb / 1024); if (verbose || context) printf(" %16s", info[i].ssid_label ? : "-"); + if (cpupool) { + char *poolname = libxl_cpupoolid_to_name(ctx, info[i].cpupool); + printf("%16s", poolname); + free(poolname); + } if (numa) { libxl_domain_get_nodeaffinity(ctx, info[i].domid, &nodemap); @@ -4686,11 +4692,13 @@ int main_list(int argc, char **argv) bool verbose = false; bool context = false; bool details = false; + bool cpupool = false; bool numa = false; static struct option opts[] = { {"long", 0, 0, 'l'}, {"verbose", 0, 0, 'v'}, {"context", 0, 0, 'Z'}, + {"cpupool", 0, 0, 'c'}, {"numa", 0, 0, 'n'}, COMMON_LONG_OPTS, {0, 0, 0, 0} @@ -4700,7 +4708,7 @@ int main_list(int argc, char **argv) libxl_dominfo *info, *info_free=0; int nb_domain, rc; - SWITCH_FOREACH_OPT(opt, "lvhZn", opts, "list", 0) { + SWITCH_FOREACH_OPT(opt, "lvhZcn", opts, "list", 0) { case 'l': details = true; break; @@ -4710,6 +4718,9 @@ int main_list(int argc, char **argv) case 'Z': context = true; break; + case 'c': + cpupool = true; + break; case 'n': numa = true; break; @@ -4744,7 +4755,7 @@ int main_list(int argc, char **argv) if (details) list_domains_details(info, nb_domain); else - list_domains(verbose, context, false /* claim */, numa, + list_domains(verbose, context, false /* claim */, numa, cpupool, info, nb_domain); if (info_free) @@ -6796,7 +6807,7 @@ int main_claims(int argc, char **argv) } list_domains(false /* verbose */, false /* context */, true /* claim */, - false /* numa */, info, nb_domain); + false /* numa */, false /* cpupool */, info, nb_domain); libxl_dominfo_list_free(info, nb_domain); return 0; diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 22ab63b334..9284887c3b 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -53,6 +53,7 @@ struct cmd_spec cmd_table[] = { "-l, --long Output all VM details\n" "-v, --verbose Prints out UUIDs and security context\n" "-Z, --context Prints out security context\n" + "-c, --cpupool Prints the cpupool the domain is in\n" "-n, --numa Prints out NUMA node affinity" }, { "destroy",