From nobody Thu May 16 04:44:59 2024 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=1606302432; cv=none; d=zohomail.com; s=zohoarc; b=M85s3CuFovh6NALiWo1dDnshSCRGVDuY6qW/VQgT2Ojv1rgpz60bwkhqNRtKHL7DZtNZfkGHz3xxIixN4vtCMiALL35dh3tLjPxSHjhPUdMtvfH/o4APcUogcNFDWpSUlGQE2+1Mrs+JocadSC1Q2r5gKbQP7ugJ3sLHFpwMoE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606302432; 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=w+G47sO31iANHcHd6/oZOWEHjUwoB6C8I0t2dfgmrjU=; b=ZCQqWTBabrlOn1OD4zhJCFJwZjjzWPMUnnnvAxGgTTuIyWl2rR1D40uEUgI+sunNtOLfgOPmv7KMJ9of/UIN+Zmz4Cc0HkoQp71sgxrqACiTA3boQ/XtWtmO8qi8ykZIvDbMp/p+KOOKWvDugjU8SrFPLHLatie6zDRi7VI5+ks= 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 16063024320339.851776591653675; Wed, 25 Nov 2020 03:07:12 -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-41-XNeZWVD9OouMzsa6l0ZB9A-1; Wed, 25 Nov 2020 06:07:08 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A3E080365B; Wed, 25 Nov 2020 11:07:02 +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 1E5B719D6C; Wed, 25 Nov 2020 11:07:02 +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 E8C10180954D; Wed, 25 Nov 2020 11:06:59 +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 0APB6vBt015754 for ; Wed, 25 Nov 2020 06:06:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 030BF5D71D; Wed, 25 Nov 2020 11:06:57 +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 EF42B5D6AC; Wed, 25 Nov 2020 11:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606302431; 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=w+G47sO31iANHcHd6/oZOWEHjUwoB6C8I0t2dfgmrjU=; b=heBYxMVY4VO+BsNofaiOWPVSkAmdipYBGoMmVNAS6unltdOQLzGom6/o92xtWzzNzheBWv qTKEGn5tK47oGNutg2W2G7qaiRp79O/gHrAIdgKXMHsl6olMhc0uG2nkfgpB2oxIrmQHeA o4RjONHjxJoDgq779ahIvsNPIURlvMo= X-MC-Unique: XNeZWVD9OouMzsa6l0ZB9A-1 From: Thomas Huth To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: agent: Store CCW address in qemuAgentDiskInfo if provided by the guest Date: Wed, 25 Nov 2020 12:06:46 +0100 Message-Id: <20201125110648.380802-2-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.84 on 10.5.11.23 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" Newer versions of the QEMU guest agent will provide the CCW address of devices on s390x. Store this information in the qemuAgentDiskInfo so that we can use this later. We also map the CSSID 0 from the guest to the value 0xfe on the host, see https://www.qemu.org/docs/master/system/s390x/css.html for details. Signed-off-by: Thomas Huth Reviewed-by: Michal Privoznik --- src/qemu/qemu_agent.c | 11 +++++++++++ src/qemu/qemu_agent.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 230253d404..d7ad20376c 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1868,6 +1868,7 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, for (i =3D 0; i < fsinfo->ndisks; i++) { virJSONValuePtr jsondisk =3D virJSONValueArrayGet(jsondisks, i); virJSONValuePtr pci; + virJSONValuePtr ccw; qemuAgentDiskInfoPtr disk; const char *val; =20 @@ -1916,6 +1917,16 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisk= s, GET_DISK_ADDR(pci, &disk->pci_controller.bus, "bus"); GET_DISK_ADDR(pci, &disk->pci_controller.slot, "slot"); GET_DISK_ADDR(pci, &disk->pci_controller.function, "function"); + + if ((ccw =3D virJSONValueObjectGet(jsondisk, "ccw-address"))) { + disk->has_ccw_address =3D true; + GET_DISK_ADDR(ccw, &disk->ccw_addr.cssid, "cssid"); + if (disk->ccw_addr.cssid =3D=3D 0) /* Guest CSSID 0 is 0xfe o= n host */ + disk->ccw_addr.cssid =3D 0xfe; + GET_DISK_ADDR(ccw, &disk->ccw_addr.ssid, "ssid"); + GET_DISK_ADDR(ccw, &disk->ccw_addr.devno, "devno"); + } + #undef GET_DISK_ADDR } =20 diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h index 7cbab489ec..37b482f3b2 100644 --- a/src/qemu/qemu_agent.h +++ b/src/qemu/qemu_agent.h @@ -77,6 +77,8 @@ struct _qemuAgentDiskInfo { unsigned int target; unsigned int unit; char *devnode; + bool has_ccw_address; + virDomainDeviceCCWAddress ccw_addr; }; =20 typedef struct _qemuAgentFSInfo qemuAgentFSInfo; --=20 2.18.4 From nobody Thu May 16 04:44:59 2024 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 From nobody Thu May 16 04:44:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1606302487; cv=none; d=zohomail.com; s=zohoarc; b=Lh7HndACvNAuwieMmxlNjOjQQyLABBCIg1ksxcWd/YQ9ltdXwNMAbCIELCZNVi7wyLd3MJ/MfXyWukYC02I9w/1caAkGbTrSlCyaR8O5x0jTNC7G+8FxSHn4BvoY6Z9OIY6UPUqwFdfKhNdM2xM+raB1N9/CfbKk9HAENp3Cb6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606302487; 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=Sevm4XbsrByVQMJkNUINnUtKP4FrLwoTD7rc+Fbg7iQ=; b=joKUwULxcbnGVnnwN9k0vRHgYxZxQqj4NJnRripGVxsBZd34qO+B8Es+ZliPIAf8eZ7tWwi6kM5fP5HAVn+O1oDpQrCIh5KvZLgnv2k4PyYB5/94LTDc5vE6k5B9JRAIlQU4UoWk7RNMx8PvVU8Nsxe6nQQWh6ncGNBBIn+5jKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606302487124119.32327171596899; Wed, 25 Nov 2020 03:08:07 -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-426-nuCWxrzuMZqIIUbovacFMw-1; Wed, 25 Nov 2020 06:07:29 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE8988145E4; Wed, 25 Nov 2020 11:07:23 +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 85DFA100AE2D; Wed, 25 Nov 2020 11:07:23 +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 4884D1809CA1; Wed, 25 Nov 2020 11:07:23 +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 0APB70hC015769 for ; Wed, 25 Nov 2020 06:07:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 06F2C5D71F; Wed, 25 Nov 2020 11:07:00 +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 116445D6AC; Wed, 25 Nov 2020 11:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606302486; 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=Sevm4XbsrByVQMJkNUINnUtKP4FrLwoTD7rc+Fbg7iQ=; b=h4dgfdnuA6wTfXfPwRdu7KM3oPtOHbQ9Tu9//YNnpAs6SOdOuPcM3qb82EGbTlXlDCwHH6 sn8imtEQYp4NrfCinWQR1zKD+mhV6XPoYruNYkZx+e0SAJp+fQErVvcsxCN3gufEAXgle0 0oj0rIm27zyMYsN7yM4l6Aiah5B36Ko= X-MC-Unique: nuCWxrzuMZqIIUbovacFMw-1 From: Thomas Huth To: libvir-list@redhat.com Subject: [PATCH 3/3] domain_conf: Allow to look up scsi disks when controller uses a CCW address Date: Wed, 25 Nov 2020 12:06:48 +0100 Message-Id: <20201125110648.380802-4-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.84 on 10.5.11.22 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 scsi controllers via their CCW address there instead of using PCI. This fixes "virsh domfsinfo" on s390x for virtio-scsi 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: Michal Privoznik --- src/conf/domain_conf.c | 23 +++++++++++++++++++++++ src/conf/domain_conf.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 00c115d453..d617580fb3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17610,6 +17610,12 @@ virDomainDiskIndexByAddress(virDomainDefPtr def, if ((cidx =3D virDomainControllerFindByPCIAddress(def, pci_address)) >= =3D 0) controller =3D def->controllers[cidx]; =20 + if (!controller && ccw_addr) { + cidx =3D virDomainControllerFindByCCWAddress(def, ccw_addr); + if (cidx >=3D 0) + controller =3D def->controllers[cidx]; + } + for (i =3D 0; i < def->ndisks; i++) { vdisk =3D def->disks[i]; if (vdisk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && @@ -18239,6 +18245,23 @@ virDomainControllerFindByType(virDomainDefPtr def, return -1; } =20 +int +virDomainControllerFindByCCWAddress(virDomainDefPtr def, + virDomainDeviceCCWAddressPtr addr) +{ + size_t i; + + for (i =3D 0; i < def->ncontrollers; i++) { + virDomainDeviceInfoPtr info =3D &def->controllers[i]->info; + + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && + virDomainDeviceCCWAddressEqual(&info->addr.ccw, addr)) + return i; + } + + return -1; +} + int virDomainControllerFindByPCIAddress(virDomainDefPtr def, virPCIDeviceAddressPtr addr) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b062b962bb..8619a85eb1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3428,6 +3428,8 @@ void virDomainControllerInsertPreAlloced(virDomainDef= Ptr def, virDomainControllerDefPtr control= ler); int virDomainControllerFind(const virDomainDef *def, int type, int idx); int virDomainControllerFindByType(virDomainDefPtr def, int type); +int virDomainControllerFindByCCWAddress(virDomainDefPtr def, + virDomainDeviceCCWAddressPtr addr); int virDomainControllerFindByPCIAddress(virDomainDefPtr def, virPCIDeviceAddressPtr addr); int virDomainControllerFindUnusedIndex(virDomainDef const *def, int type); --=20 2.18.4