From nobody Sun Feb 8 19:39:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606302450; cv=none; d=zohomail.com; s=zohoarc; b=HaS9kNvrsjL/z+DwfOZuRulbplkEbrkzfGHKK1wa22lhksF8fOpEpKsFGwAIypo6P+9kmv4LISvAzX/ctX22vkkE8ljSIqOxi5nwPdCyz+Sk+9+plDazrbsurJVecdloybtKzojElq3eBv5luOEbSQ7Gy4RCAB1GAfp6Ros7PvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606302450; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=SexIDKtDijQxERx0bl/AV26a72kVoCjIaR/JGKMiCIQ=; b=TapVLf8zMVccanqysvJV76IEuXFvdZsJ9/b0sf5Q7LKNk55VNeoPpljgdr/+Qd5NwRc+U1t8wpP82lBJccOiZSsgXl1PPbvAdppvWcf5hKl9eX9tTUoWH14UGLpQtDCVHZK6piIdEgn0sXka4RtKw7qzrGmm/HxSkfJr7G7qtDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606302450807138.58964694482245; Wed, 25 Nov 2020 03:07:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-Uy051oKDNnGxonxHNOG3Yw-1; Wed, 25 Nov 2020 06:07:27 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29FA41005D44; Wed, 25 Nov 2020 11:07:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 095445D9C2; Wed, 25 Nov 2020 11:07:21 +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 A9FCE4E590; Wed, 25 Nov 2020 11:07:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0APB6wVQ015761 for ; Wed, 25 Nov 2020 06:06:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id A60F65D71D; Wed, 25 Nov 2020 11:06:58 +0000 (UTC) Received: from thuth.com (ovpn-112-81.ams2.redhat.com [10.36.112.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D7A35D6AC; Wed, 25 Nov 2020 11:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606302449; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SexIDKtDijQxERx0bl/AV26a72kVoCjIaR/JGKMiCIQ=; b=YRz4RtmaOYqzO3Ia1SFvGCnfeWAoFwDxxJrKmnonxZWG8ehJcloQqLkWlDx6mpdjjl4sDR mr8XQ58/lgb4PYzyzJomf1on6MI1d6f1aqKApWX310XOI07pCARw+W0NxXH3weODWy27zO nQ05XNtiLo3dXDg82SB+zK2dQ0tWpEU= X-MC-Unique: Uy051oKDNnGxonxHNOG3Yw-1 From: Thomas Huth To: libvir-list@redhat.com Subject: [PATCH 2/3] domain_conf: Allow to look up virtio-block devices by their CCW address Date: Wed, 25 Nov 2020 12:06:47 +0100 Message-Id: <20201125110648.380802-3-thuth@redhat.com> In-Reply-To: <20201125110648.380802-1-thuth@redhat.com> References: <20201125110648.380802-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On s390x, devices are attached to the channel IO subsytem by default, so we need to look up the devices via their CCW address there instead of using PCI. This fixes "virsh domfsinfo" on s390x for virtio-block devices (the first attempt from commit f8333b3b0a7 did it in the wrong way, reporting the device name on the guest side instead of the target name on the host side). Fixes: f8333b3b0a ("qemu: Fix domfsinfo for non-PCI device information ...") Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1858771 Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 10 +++++++++- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_driver.c | 8 +++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2393bf6a37..00c115d453 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17598,6 +17598,7 @@ virDomainDiskControllerMatch(int controller_type, i= nt disk_bus) int virDomainDiskIndexByAddress(virDomainDefPtr def, virPCIDeviceAddressPtr pci_address, + virDomainDeviceCCWAddressPtr ccw_addr, unsigned int bus, unsigned int target, unsigned int unit) { @@ -17614,6 +17615,11 @@ virDomainDiskIndexByAddress(virDomainDefPtr def, if (vdisk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && virPCIDeviceAddressEqual(&vdisk->info.addr.pci, pci_address)) return i; + if (vdisk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && + ccw_addr && + virDomainDeviceCCWAddressEqual(&vdisk->info.addr.ccw, ccw_addr= )) { + return i; + } if (vdisk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { virDomainDeviceDriveAddressPtr drive =3D &vdisk->info.addr.dri= ve; if (controller && @@ -17630,11 +17636,13 @@ virDomainDiskIndexByAddress(virDomainDefPtr def, virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def, virPCIDeviceAddressPtr pci_address, + virDomainDeviceCCWAddressPtr ccw_addr, unsigned int bus, unsigned int target, unsigned int unit) { - int idx =3D virDomainDiskIndexByAddress(def, pci_address, bus, target,= unit); + int idx =3D virDomainDiskIndexByAddress(def, pci_address, ccw_addr, + bus, target, unit); return idx < 0 ? NULL : def->disks[idx]; } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 96e6c34553..b062b962bb 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3342,10 +3342,12 @@ void virDomainRNGDefFree(virDomainRNGDefPtr def); =20 int virDomainDiskIndexByAddress(virDomainDefPtr def, virPCIDeviceAddressPtr pci_controller, + virDomainDeviceCCWAddressPtr ccw_addr, unsigned int bus, unsigned int target, unsigned int unit); virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def, virPCIDeviceAddressPtr pci_cont= roller, + virDomainDeviceCCWAddressPtr cc= w_addr, unsigned int bus, unsigned int target, unsigned int unit); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b69be1bedc..7324412708 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18852,15 +18852,15 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent, =20 diskDef =3D virDomainDiskByAddress(vmdef, &agentdisk->pci_controller, + agentdisk->has_ccw_address ? + &agentdisk->ccw_addr : NULL, agentdisk->bus, agentdisk->target, agentdisk->unit); if (diskDef !=3D NULL) ret->devAlias[i] =3D g_strdup(diskDef->dst); - else if (agentdisk->devnode !=3D NULL) - ret->devAlias[i] =3D g_strdup(agentdisk->devnode); else - VIR_DEBUG("Missing devnode name for '%s'.", ret->mountpoint); + VIR_DEBUG("Missing target name for '%s'.", ret->mountpoint); } =20 return ret; @@ -19903,6 +19903,8 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsi= nfo, /* match the disk to the target in the vm definition */ diskdef =3D virDomainDiskByAddress(vmdef, &d->pci_controller, + d->has_ccw_address ? + &d->ccw_addr : NULL, d->bus, d->target, d->unit); --=20 2.18.4