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=1858771
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
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, int 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 == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
virPCIDeviceAddressEqual(&vdisk->info.addr.pci, pci_address))
return i;
+ if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
+ ccw_addr &&
+ virDomainDeviceCCWAddressEqual(&vdisk->info.addr.ccw, ccw_addr)) {
+ return i;
+ }
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
virDomainDeviceDriveAddressPtr drive = &vdisk->info.addr.drive;
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 = virDomainDiskIndexByAddress(def, pci_address, bus, target, unit);
+ int idx = virDomainDiskIndexByAddress(def, pci_address, ccw_addr,
+ bus, target, unit);
return idx < 0 ? NULL : def->disks[idx];
}
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);
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_controller,
+ virDomainDeviceCCWAddressPtr ccw_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,
diskDef = virDomainDiskByAddress(vmdef,
&agentdisk->pci_controller,
+ agentdisk->has_ccw_address ?
+ &agentdisk->ccw_addr : NULL,
agentdisk->bus,
agentdisk->target,
agentdisk->unit);
if (diskDef != NULL)
ret->devAlias[i] = g_strdup(diskDef->dst);
- else if (agentdisk->devnode != NULL)
- ret->devAlias[i] = g_strdup(agentdisk->devnode);
else
- VIR_DEBUG("Missing devnode name for '%s'.", ret->mountpoint);
+ VIR_DEBUG("Missing target name for '%s'.", ret->mountpoint);
}
return ret;
@@ -19903,6 +19903,8 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
/* match the disk to the target in the vm definition */
diskdef = virDomainDiskByAddress(vmdef,
&d->pci_controller,
+ d->has_ccw_address ?
+ &d->ccw_addr : NULL,
d->bus,
d->target,
d->unit);
--
2.18.4
On Wed, 25 Nov 2020 12:06:47 +0100
Thomas Huth <thuth@redhat.com> wrote:
> On s390x, devices are attached to the channel IO subsytem by default,
s/attached to the channel IO subsystem/accessed via the channel subsystem/
> 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=1858771
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> 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(-)
Keeping my limited libvirt knowledge in mind:
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
On 11/25/20 12:06 PM, Thomas Huth wrote:
> 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=1858771
Nit pick, we tend to use Resolves: for bugs.
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> 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(-)
I've also needed to adapt one more call of virDomainDiskByAddress()
because of yet another of Marc-Andre's patch I've merged :-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Michal
© 2016 - 2026 Red Hat, Inc.