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=1858771 Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx> --- 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 = virDomainControllerFindByPCIAddress(def, pci_address)) >= 0) controller = def->controllers[cidx]; + if (!controller && ccw_addr) { + cidx = virDomainControllerFindByCCWAddress(def, ccw_addr); + if (cidx >= 0) + controller = def->controllers[cidx]; + } + for (i = 0; i < def->ndisks; i++) { vdisk = def->disks[i]; if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && @@ -18239,6 +18245,23 @@ virDomainControllerFindByType(virDomainDefPtr def, return -1; } +int +virDomainControllerFindByCCWAddress(virDomainDefPtr def, + virDomainDeviceCCWAddressPtr addr) +{ + size_t i; + + for (i = 0; i < def->ncontrollers; i++) { + virDomainDeviceInfoPtr info = &def->controllers[i]->info; + + if (info->type == 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(virDomainDefPtr def, virDomainControllerDefPtr controller); 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); -- 2.18.4