From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DATE_IN_PAST_96_XX, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C460FC433E0 for ; Mon, 4 Jan 2021 22:53:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 834602074B for ; Mon, 4 Jan 2021 22:53:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 834602074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=m5p.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.61574.108456 (Exim 4.92) (envelope-from ) id 1kwYib-0001Ya-R3; Mon, 04 Jan 2021 22:52:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 61574.108456; Mon, 04 Jan 2021 22:52:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwYib-0001YT-O8; Mon, 04 Jan 2021 22:52:53 +0000 Received: by outflank-mailman (input) for mailman id 61574; Mon, 04 Jan 2021 22:52:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwYia-0001Y4-5z for xen-devel@lists.xenproject.org; Mon, 04 Jan 2021 22:52:52 +0000 Received: from mailhost.m5p.com (unknown [74.104.188.4]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0be40137-2e97-4a36-9886-3693e0ce814a; Mon, 04 Jan 2021 22:52:51 +0000 (UTC) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.15.2/8.15.2) with ESMTPS id 104MqgfU071507 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Jan 2021 17:52:47 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.15.2/8.15.2/Submit) id 104MqgmL071506; Mon, 4 Jan 2021 14:52:42 -0800 (PST) (envelope-from ehem) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0be40137-2e97-4a36-9886-3693e0ce814a Message-Id: <23d48471e5f987736525b4d2be71419953fd4698.1608663694.git.ehem+xen@m5p.com> In-Reply-To: References: From: Elliott Mitchell To: xen-devel@lists.xenproject.org Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD Date: Wed, 9 Dec 2020 14:34:37 -0800 Subject: [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 --- 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 O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445