All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Juergen Gross <JGross@suse.com>, Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 4/9] xl: add -c/--cpupool option to `xl list'
Date: Fri, 06 Mar 2015 18:21:23 +0100	[thread overview]
Message-ID: <20150306172123.7269.98465.stgit@Solace.station> (raw)
In-Reply-To: <20150306170758.7269.53821.stgit@Solace.station>

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 <dario.faggioli@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Juergen Gross <JGross@suse.com>
---
 docs/man/xl.pod.1         |    4 ++++
 tools/libxl/xl_cmdimpl.c  |   20 ++++++++++++++++----
 tools/libxl/xl_cmdtable.c |    1 +
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
index 861ae21..c330016 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 69469ff..42b3954 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3521,7 +3521,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";
@@ -3535,6 +3535,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");
@@ -3579,6 +3580,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);
 
@@ -4508,11 +4514,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}
@@ -4522,7 +4530,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;
@@ -4532,6 +4540,9 @@ int main_list(int argc, char **argv)
     case 'Z':
         context = true;
         break;
+    case 'c':
+        cpupool = true;
+        break;
     case 'n':
         numa = true;
         break;
@@ -4566,7 +4577,8 @@ int main_list(int argc, char **argv)
     if (details)
         list_domains_details(info, nb_domain);
     else
-        list_domains(verbose, context, 0 /* claim */, numa, info, nb_domain);
+        list_domains(verbose, context, false /* claim */, numa, cpupool,
+                     info, nb_domain);
 
     if (info_free)
         libxl_dominfo_list_free(info, nb_domain);
@@ -6617,7 +6629,7 @@ int main_claims(int argc, char **argv)
     }
 
     list_domains(0 /* verbose */, 0 /* context */, 1 /* claim */,
-                 0 /* numa */, info, nb_domain);
+                 0 /* numa */, 0 /* 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 22ab63b..9284887 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",

  parent reply	other threads:[~2015-03-06 17:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 17:20 [PATCH 0/9] Some (not only) cpupool related fixes and improvements Dario Faggioli
2015-03-06 17:20 ` [PATCH 1/9] docs: RTDS is a valid alternative as a scheduler for a cpupool Dario Faggioli
2015-03-06 19:16   ` Meng Xu
2015-03-09 10:20   ` Wei Liu
2015-03-06 17:21 ` [PATCH 2/9] docs: fix `xl list' manpage entry Dario Faggioli
2015-03-09 10:21   ` Wei Liu
2015-03-06 17:21 ` [PATCH 3/9] xl: turn some int local variable into bool Dario Faggioli
2015-03-09 10:24   ` Wei Liu
2015-03-06 17:21 ` Dario Faggioli [this message]
2015-03-09 10:27   ` [PATCH 4/9] xl: add -c/--cpupool option to `xl list' Wei Liu
2015-03-06 17:21 ` [PATCH 5/9] libxl: introduce libxl_cpupool_cpu{add, remove}_cpumap() Dario Faggioli
2015-03-09 10:39   ` Wei Liu
2015-03-09 11:31     ` Dario Faggioli
2015-03-09 11:47       ` Wei Liu
2015-03-11 16:42     ` Ian Campbell
2015-03-11 16:50       ` Dario Faggioli
2015-03-11 16:57         ` Ian Campbell
2015-03-06 17:21 ` [PATCH 6/9] xl: enable using ranges of pCPUs when manipulating cpupools Dario Faggioli
2015-03-09 10:51   ` Wei Liu
2015-03-09 11:37     ` Dario Faggioli
2015-03-06 17:21 ` [PATCH 7/9] xl: enable using ranges of pCPUs when creating cpupools Dario Faggioli
2015-03-09 10:58   ` Wei Liu
2015-03-09 11:18     ` Dario Faggioli
2015-03-09 11:20       ` Wei Liu
2015-03-06 17:21 ` [PATCH 8/9] xl: make error reporting of cpupool subcommands consistent Dario Faggioli
2015-03-09 11:01   ` Wei Liu
2015-03-09 11:23     ` Dario Faggioli
2015-03-11 14:52     ` Ian Campbell
2015-03-11 15:04       ` Wei Liu
2015-03-11 15:13         ` Dario Faggioli
2015-03-11 15:23           ` Wei Liu
2015-03-11 16:22             ` Dario Faggioli
2015-03-11 16:24               ` Wei Liu
2015-03-11 16:28                 ` Dario Faggioli
2015-03-11 15:14         ` Ian Campbell
2015-03-06 17:22 ` [PATCH 9/9] xl: use libxl_cpupoolinfo_list_free() in main_cpupoolnumasplit Dario Faggioli
2015-03-09 11:02   ` Wei Liu
2015-03-11 14:54   ` Ian Campbell
2015-03-11 14:56 ` [PATCH 0/9] Some (not only) cpupool related fixes and improvements Ian Campbell
2015-03-11 15:09   ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150306172123.7269.98465.stgit@Solace.station \
    --to=dario.faggioli@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JGross@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.