On s390x, devices are accessed via the channel subsystem 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 ...")
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1858771
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
int
virDomainDiskIndexByAddress(virDomainDefPtr def,
virPCIDeviceAddressPtr pci_address,
+ virDomainDeviceCCWAddressPtr ccw_addr,
unsigned int bus, unsigned int target,
unsigned int unit)
{
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 &&
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];
}
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);
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;
/* match the disk to the target in the vm definition */
diskdef = virDomainDiskByAddress(vmdef,
&info[i]->address->pci_controller,
+ info[i]->address->has_ccw_address ?
+ &info[i]->address->ccw_addr : NULL,
info[i]->address->bus,
info[i]->address->target,
info[i]->address->unit);
/* 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);