From nobody Mon Sep 16 19:33:28 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 1705684221860524.2886699911987; Fri, 19 Jan 2024 09:10:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A9E5F1B96; Fri, 19 Jan 2024 12:10:20 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 884EB1D29; Fri, 19 Jan 2024 12:05:45 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C18F11CC9; Fri, 19 Jan 2024 12:05:33 -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 3725D1A49 for ; Fri, 19 Jan 2024 12:03:45 -0500 (EST) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40JGFfbb002770 for ; Fri, 19 Jan 2024 16:38:59 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vqv8dry10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 19 Jan 2024 16:38:58 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40JGFpW3003905 for ; Fri, 19 Jan 2024 16:38:58 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vqv8dry0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 16:38:58 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40JE5B8p000561; Fri, 19 Jan 2024 16:38:57 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3vm4utasjm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 16:38:57 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40JGcspt44630384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Jan 2024 16:38:54 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72E982004D; Fri, 19 Jan 2024 16:38:54 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5465120043; Fri, 19 Jan 2024 16:38:54 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.171.151.33]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 19 Jan 2024 16:38:54 +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 05/11] tools: add option inactive to nodedev-dumpxml Date: Fri, 19 Jan 2024 17:38:47 +0100 Message-ID: <20240119163853.10191-6-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240119163853.10191-1-fiuczy@linux.ibm.com> References: <20240119163853.10191-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: N2mQKRvKvJ0ayPSAGfLoYaBo5XQP8n1d X-Proofpoint-ORIG-GUID: xWR4ck808foWflaJ1vQVFflVQSJ5J039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-19_10,2024-01-19_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxlogscore=747 adultscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401190095 Message-ID-Hash: ZOT4RNCJBRD7N72LG664EEYTPFMB3FGA X-Message-ID-Hash: ZOT4RNCJBRD7N72LG664EEYTPFMB3FGA 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: 1705684222421100001 Allow to dump the XML of the persisted mdev when the mdev has been started instead of the current state only. Signed-off-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma --- docs/manpages/virsh.rst | 7 +++++-- tools/virsh-nodedev.c | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index ed1027e133..3a814dccd2 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5422,14 +5422,17 @@ nodedev-dumpxml =20 :: =20 - nodedev-dumpxml [--xpath EXPRESSION] [--wrap] device + nodedev-dumpxml [--inactive] [--xpath EXPRESSION] [--wrap] device =20 Dump a XML representation for the given node device, including such information as the device name, which bus owns the device, the vendor and product id, and any capabilities of the device usable by libvirt (such as whether device reset is supported). *device* can be either device name or wwn pair in "wwnn,wwpn" format (only works -for HBA). +for HBA). An additional option affecting the XML dump may be +used. *--inactive* tells virsh to dump the node device configuration +that will be used on next start of the node device as opposed to the +current node device configuration. =20 If the **--xpath** argument provides an XPath expression, it will be evaluated against the output XML and only those matching nodes will diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index fb38fd7fcc..54e192d619 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -575,6 +575,10 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, + {.name =3D "inactive", + .type =3D VSH_OT_BOOL, + .help =3D N_("show inactive defined XML"), + }, {.name =3D "xpath", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_REQ_OPT, @@ -594,6 +598,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) g_autoptr(virshNodeDevice) device =3D NULL; g_autofree char *xml =3D NULL; const char *device_value =3D NULL; + unsigned int flags =3D 0; bool wrap =3D vshCommandOptBool(cmd, "wrap"); const char *xpath =3D NULL; =20 @@ -608,7 +613,15 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cm= d) if (!device) return false; =20 - if (!(xml =3D virNodeDeviceGetXMLDesc(device, 0))) + if (vshCommandOptBool(cmd, "inactive")) { + flags |=3D VIR_NODE_DEVICE_GET_XML_DESC_INACTIVE; + if (!virNodeDeviceIsPersistent(device)) { + vshError(ctl, _("Node device '%1$s' is not persistent"), devic= e_value); + return false; + } + } + + if (!(xml =3D virNodeDeviceGetXMLDesc(device, flags))) return false; =20 return virshDumpXML(ctl, xml, "node-device", xpath, wrap); --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org