[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[WIP PATCH 14/16] WIP: tools/xl: Enhance "list" command



Add several features to specify output.  Allow omitting potentially
unneeded lines and add argument for exact line format.

Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx>
---
 tools/xl/xl_cmdtable.c |  2 ++
 tools/xl/xl_list.c     | 16 +++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index f44c65a3f8..91c2026bc8 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -53,6 +53,7 @@ struct cmd_spec cmd_table[] = {
       &main_list, 0, 0,
       "List information about all/some domains",
       "[options] [Domain]\n",
+      "-0, --no-domain0        Omit information for Domain 0\n"
       "-F, --format            Specify output format string\n"
       "   Similar to printf(3) formatting, conversion characters are:\n"
       "      %A    NODE Affinity\n"
@@ -67,6 +68,7 @@ struct cmd_spec cmd_table[] = {
       "      %t    Time(s)\n"
       "      %u    UUID\n"
       "      %v    vCPUs\n"
+      "-H, --no-header         Omit table header\n"
       "-Z, --context           Prints out security context\n"
       "-c, --cpupool           Prints the cpupool the domain is in\n"
       "-l, --long              Output all VM details\n"
diff --git a/tools/xl/xl_list.c b/tools/xl/xl_list.c
index 3ed6da8feb..49ff2acaad 100644
--- a/tools/xl/xl_list.c
+++ b/tools/xl/xl_list.c
@@ -397,6 +397,8 @@ int main_list(int argc, char **argv)
     bool context = false;
     bool cpupool = false;
     bool details = false;
+    bool dom0 = true;
+    bool header = true;
     const char *formatstr = NULL;
     bool numa = false;
     bool verbose = false;
@@ -405,6 +407,8 @@ int main_list(int argc, char **argv)
         {"cpupool", 0, 0, 'c'},
         {"format", 0, 0, 'F'},
         {"long", 0, 0, 'l'},
+        {"no-domain0", 0, 0, '0'},
+        {"no-header", 0, 0, 'H'},
         {"numa", 0, 0, 'n'},
         {"verbose", 0, 0, 'v'},
         COMMON_LONG_OPTS
@@ -414,10 +418,16 @@ int main_list(int argc, char **argv)
     libxl_dominfo *info, *info_free=0;
     int nb_domain, rc;
 
-    SWITCH_FOREACH_OPT(opt, "F:Zchlnv", opts, "list", 0) {
+    SWITCH_FOREACH_OPT(opt, "0F:HZchlnv", opts, "list", 0) {
+    case '0':
+        dom0 = false;
+        break;
     case 'F':
         formatstr = optarg;
         break;
+    case 'H':
+        header = false;
+        break;
     case 'Z':
         context = true;
         break;
@@ -476,10 +486,10 @@ int main_list(int argc, char **argv)
             return EXIT_FAILURE;
         }
 
-        format(formats, formatstr, NULL);
+        if (header) format(formats, formatstr, NULL);
 
         while (nb_domain) {
-            format(formats, formatstr, info);
+            if (info->domid || dom0) format(formats, formatstr, info);
             ++info;
             --nb_domain;
         }
-- 


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg@xxxxxxx  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445






 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.