mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
qemu: Rework qemuDomainDeviceDefValidateAddress()
Introduce a switch() statement and prepare for validating more address types than just PCI. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
120cdd7e2c
commit
ad9b36efcd
@ -6194,9 +6194,35 @@ qemuDomainDeviceDefValidateAddress(const virDomainDeviceDef *dev,
|
|||||||
if (!(info = virDomainDeviceGetInfo((virDomainDeviceDef *)dev)))
|
if (!(info = virDomainDeviceGetInfo((virDomainDeviceDef *)dev)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
|
switch ((virDomainDeviceAddressType) info->type) {
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
||||||
return qemuDomainDeviceDefValidateZPCIAddress(info, qemuCaps);
|
return qemuDomainDeviceDefValidateZPCIAddress(info, qemuCaps);
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
|
||||||
|
/* Address validation might happen before we have had a chance to
|
||||||
|
* automatically assign addresses to devices for which the user
|
||||||
|
* didn't specify one themselves */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
|
||||||
|
/* No validation for these address types yet */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virDomainDeviceAddressType, info->type);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user