All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elliott Mitchell <ehem+xen@m5p.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <iwj@xenproject.org>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>
Subject: [WIP PATCH 14/16] WIP: tools/xl: Enhance "list" command
Date: Wed, 9 Dec 2020 14:34:37 -0800	[thread overview]
Message-ID: <23d48471e5f987736525b4d2be71419953fd4698.1608663694.git.ehem+xen@m5p.com> (raw)
In-Reply-To: <cover.1608663694.git.ehem+xen@m5p.com>

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@m5p.com>
---
 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@m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





  reply	other threads:[~2021-01-04 22:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 19:01 [WIP PATCH 00/16] Addition of formatting options to `xl list` subcommands Elliott Mitchell
2020-12-09 22:34 ` Elliott Mitchell [this message]
2020-12-09 22:34 ` [WIP PATCH 07/16] tools/xl: Sort list command options Elliott Mitchell
2020-12-09 22:45 ` [WIP PATCH 06/16] tools/xl: Split list commands off of xl_info.c Elliott Mitchell
2020-12-10 23:09 ` [WIP PATCH 09/16] WIP: tools/xl: Implement generalized output formatting for `xl list` Elliott Mitchell
2020-12-10 23:09 ` [WIP PATCH 10/16] WIP: tools/xl: Implement output format option Elliott Mitchell
2020-12-10 23:09 ` [WIP PATCH 08/16] tools/xl: Fix potential deallocation bug Elliott Mitchell
2020-12-12  6:18 ` [WIP PATCH 11/16] WIP: tools/xl: Replace most of list_domains with use of format() Elliott Mitchell
2020-12-13  4:42 ` [WIP PATCH 12/16] WIP: UNTESTED: tools/xl: Replace remaining options with format() Elliott Mitchell
2020-12-13  5:14 ` [WIP PATCH 13/16] WIP: tools/xl: Purge list_domains() Elliott Mitchell
2020-12-18  1:42 ` [WIP PATCH 04/16] tools/xl: Rename printf_info()/list_domains_details() to dump_by_...() Elliott Mitchell
2020-12-18  1:42 ` [WIP PATCH 05/16] tools/xl: Merge down debug/dry-run section of create_domain() Elliott Mitchell
2020-12-18 21:32 ` [WIP PATCH 03/16] tools/xl: Mark libxl_domain_config * arg of printf_info_*() const Elliott Mitchell
2020-12-18 21:37 ` [WIP PATCH 01/16] tools/libxl: Mark pointer args of many functions constant Elliott Mitchell
2020-12-18 22:45 ` [WIP PATCH 02/16] tools/libxl: Tiny optimization of libxl__mac_is_default() Elliott Mitchell
2020-12-19  7:23 ` [WIP PATCH 15/16] WIP: tools/xl: Implement output format option for "vm-list" command Elliott Mitchell
2020-12-20  7:43 ` [WIP PATCH 16/16] WIP: tools/xl: Enhance " Elliott Mitchell

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=23d48471e5f987736525b4d2be71419953fd4698.1608663694.git.ehem+xen@m5p.com \
    --to=ehem+xen@m5p.com \
    --cc=iwj@xenproject.org \
    --cc=xen-devel@lists.xenproject.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.