From nobody Mon Sep 16 18:59:34 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1707314229930457.2967191379935; Wed, 7 Feb 2024 05:57:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id B098D1E19; Wed, 7 Feb 2024 08:57:08 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 58BE11DBA; Wed, 7 Feb 2024 08:41:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 45FE51A76; Wed, 7 Feb 2024 08:40:09 -0500 (EST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1CBF41BE8 for ; Wed, 7 Feb 2024 08:40:03 -0500 (EST) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 417DCEPU014578 for ; Wed, 7 Feb 2024 13:40:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w4ahr0vj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 07 Feb 2024 13:40:01 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 417DCKwW014796 for ; Wed, 7 Feb 2024 13:40:01 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w4ahr0vhn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Feb 2024 13:40:00 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 417AXl2O008823; Wed, 7 Feb 2024 13:39:59 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w206yp3wy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Feb 2024 13:39:59 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 417Ddu0U28115486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Feb 2024 13:39:56 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B3672004B; Wed, 7 Feb 2024 13:39:56 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CFDB20049; Wed, 7 Feb 2024 13:39:56 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 7 Feb 2024 13:39:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH v2 07/11] tools: add switches persisted and transient to nodedev-list Date: Wed, 7 Feb 2024 14:39:50 +0100 Message-ID: <20240207133954.86634-8-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207133954.86634-1-fiuczy@linux.ibm.com> References: <20240207133954.86634-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vE7gSAcYvHiFEvAlYQB_5F8xB2HrhE0I X-Proofpoint-ORIG-GUID: SEHTViUExI5BBjugV_fqbtK9VMLaSEbP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-07_04,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxlogscore=944 bulkscore=0 adultscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402070101 Message-ID-Hash: 4NTZSOJ3I6OATKKAV74DPY746POL2MPS X-Message-ID-Hash: 4NTZSOJ3I6OATKKAV74DPY746POL2MPS X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jjongsma@redhat.com, mhartmay@linux.ibm.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1707314231497100001 Now that we can filter persisted and transient node devices in virConnectListAllNodeDevices(), add these switches also to the virsh nodedev-list command. Signed-off-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma --- docs/manpages/virsh.rst | 8 ++++++-- tools/virsh-nodedev.c | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 3a814dccd2..248807d0e9 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5461,7 +5461,7 @@ nodedev-list =20 :: =20 - nodedev-list [--cap capability] [--tree] [--inactive | --all] + nodedev-list [--cap capability] [--tree] [--inactive | --all] [--persis= tent | --transient] =20 List all of the devices available on the node that are known by libvirt. *cap* is used to filter the list by capability types, the types must be @@ -5470,7 +5470,11 @@ separated by comma, e.g. --cap pci,scsi. Valid capab= ility types include 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', 'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue', 'ap_matrix'. By default, only active devices are listed. *--inactive* is used to list only inactive -devices, and *-all* is used to list both active and inactive devices. +devices, and *--all* is used to list both active and inactive devices. +*--persistent* is used to list only persistent devices, and *--transient* = is +used to list only transient devices. Not providing *--persistent* or +*--transient* will list all devices unless filtered otherwise. *--transien= t* +is mutually exclusive with *--persistent* and *--inactive*. If *--tree* is used, the output is formatted in a tree representing parent= s of each node. *--tree* is mutually exclusive with all other options. =20 diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index aeb3685aca..5942c43689 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -390,6 +390,14 @@ static const vshCmdOptDef opts_node_list_devices[] =3D= { .type =3D VSH_OT_BOOL, .help =3D N_("list inactive & active devices") }, + {.name =3D "persistent", + .type =3D VSH_OT_BOOL, + .help =3D N_("list persistent devices") + }, + {.name =3D "transient", + .type =3D VSH_OT_BOOL, + .help =3D N_("list transient devices") + }, {.name =3D NULL} }; =20 @@ -407,6 +415,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) int cap_type =3D -1; bool inactive =3D vshCommandOptBool(cmd, "inactive"); bool all =3D vshCommandOptBool(cmd, "all"); + bool persistent =3D vshCommandOptBool(cmd, "persistent"); + bool transient =3D vshCommandOptBool(cmd, "transient"); =20 ignore_value(vshCommandOptStringQuiet(ctl, cmd, "cap", &cap_str)); =20 @@ -420,8 +430,13 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd = G_GNUC_UNUSED) return false; } =20 - if (tree && (cap_str || inactive)) { - vshError(ctl, "%s", _("Option --tree is incompatible with --cap an= d --inactive")); + if (transient && (persistent || inactive)) { + vshError(ctl, "%s", _("Option --transient is incompatible with --p= ersistent and --inactive")); + return false; + } + + if (tree && (cap_str || inactive || persistent || transient)) { + vshError(ctl, "%s", _("Option --tree is incompatible with --cap, -= -inactive, --persistent and --transient")); return false; } =20 @@ -509,6 +524,11 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd = G_GNUC_UNUSED) if (!inactive) flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE; =20 + if (persistent) + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT; + if (transient) + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT; + if (!(list =3D virshNodeDeviceListCollect(ctl, caps, ncaps, flags))) { ret =3D false; goto cleanup; --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org