From nobody Mon Feb 9 17:07:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569514991; cv=none; d=zoho.com; s=zohoarc; b=iBsveYxKWvCSu9BONusMDQM25UFwA6kFrSq10mta7MP8zLZZbhUDk4K3/jTzqjFKO9gKRlDDJUtBktBd/0AEI0hoZRMTTzJL2xuLjA+p1DG2hLb1D01rWef7hI9cs34AghJv5ZvhKZr+FFTwLP47MnfDIfu5CR4E4/eZGJmC5vQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569514991; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UXwjnHs2ZL70yFKz8I+Ma3ZkEWFlJCmVXMFXKiC80BE=; b=MFoAwZA4vVfwpcR7OBxOIwR0hd/nQn/4aLdfILt3+3q0MgZXpXhOfy+UJbcynq/2DuaxoanTAP680s6gk6cHXPWAzpDiKayWLtGIbUq/B9KzU8kmrdASnZfs9r5SyRH9Yp79N+wFARtc98GR8ye0HIaAsT5L07IOdDLgBQZAcvA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156951499120650.94786555520329; Thu, 26 Sep 2019 09:23:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C41918C4269; Thu, 26 Sep 2019 16:23:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77E6B1FD3C; Thu, 26 Sep 2019 16:23:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 38F55180B76F; Thu, 26 Sep 2019 16:23:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QGFC3v003989 for ; Thu, 26 Sep 2019 12:15:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 031B05D9D5; Thu, 26 Sep 2019 16:15:12 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F6A75D9E2 for ; Thu, 26 Sep 2019 16:15:08 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 18:12:35 +0200 Message-Id: <4b0db282c4a6c45daacd778c3bba2af282166663.1569514291.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 39/39] virsh: Introduce nvme disk to domblklist X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 26 Sep 2019 16:23:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This is slightly more complicated because NVMe disk source is not a simple attribute to element. The format in which the PCI address and namespace ID are printed is the same as QEMU accepts them: nvme://XXXX:XX:XX.X/X Signed-off-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 0e2c4191d7..f663a87f8f 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -627,8 +627,8 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) for (i =3D 0; i < ndisks; i++) { ctxt->node =3D disks[i]; =20 + type =3D virXPathString("string(./@type)", ctxt); if (details) { - type =3D virXPathString("string(./@type)", ctxt); device =3D virXPathString("string(./@device)", ctxt); if (!type || !device) { vshPrint(ctl, "unable to query block list details"); @@ -641,11 +641,30 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) vshError(ctl, "unable to query block list"); goto cleanup; } - source =3D virXPathString("string(./source/@file" - "|./source/@dev" - "|./source/@dir" - "|./source/@name" - "|./source/@volume)", ctxt); + + if (STREQ_NULLABLE(type, "nvme")) { + VIR_AUTOFREE(char *) namespace =3D NULL; + virPCIDeviceAddress addr =3D { 0 }; + xmlNodePtr addrNode =3D NULL; + + if (!(namespace =3D virXPathString("string(./source/@namespace= )", ctxt)) || + !(addrNode =3D virXPathNode("./source/address", ctxt)) || + virPCIDeviceAddressParseXML(addrNode, &addr) < 0) { + vshError(ctl, "Unable to query NVMe disk address"); + goto cleanup; + } + + if (virAsprintf(&source, "nvme://%04x:%02x:%02x.%d/%s", + addr.domain, addr.bus, addr.slot, addr.functio= n, namespace) < 0) + goto cleanup; + } else { + source =3D virXPathString("string(./source/@file" + "|./source/@dev" + "|./source/@dir" + "|./source/@name" + "|./source/@volume)", ctxt); + } + if (details) { if (vshTableRowAppend(table, type, device, target, NULLSTR_MINUS(source), NULL) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list