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

[WIP PATCH 16/16] WIP: tools/xl: Enhance "vm-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_list.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/xl/xl_list.c b/tools/xl/xl_list.c
index 58809aa10b..ef44466017 100644
--- a/tools/xl/xl_list.c
+++ b/tools/xl/xl_list.c
@@ -500,18 +500,28 @@ int main_list(int argc, char **argv)
 int main_vm_list(int argc, char **argv)
 {
     const char *formatstr = "%u %5i %n\n";
+    bool dom0 = true;
+    bool header = true;
     int opt;
     static const struct option opts[] = {
         {"format", 0, 0, 'F'},
+        {"no-domain0", 0, 0, '0'},
+        {"no-header", 0, 0, 'H'},
     };
 
     libxl_vminfo *info;
     int nb_vm, i;
 
-    SWITCH_FOREACH_OPT(opt, "F:", opts, "vm-list", 0) {
+    SWITCH_FOREACH_OPT(opt, "0F:H", opts, "vm-list", 0) {
+    case '0':
+        dom0 = false;
+        break;
     case 'F':
         formatstr = optarg;
         break;
+    case 'H':
+        header = false;
+        break;
     }
 
     info = libxl_list_vm(ctx, &nb_vm);
@@ -521,10 +531,10 @@ int main_vm_list(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
-    format(formats_vm, formatstr, NULL);
+    if (header) format(formats_vm, formatstr, NULL);
 
     for (i = 0; i < nb_vm; i++)
-        format(formats_vm, formatstr, info + i);
+        if (info[i].domid || dom0) format(formats_vm, formatstr, info + i);
 
     libxl_vminfo_list_free(info, nb_vm);
 
-- 


-- 
(\___(\___(\______          --=> 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®.