mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: Use switch for qemuCheckIOThreads
Rather than an if statement, use a switch. The switch will also catch the illegal usage of 'iothread' with some other kind of unsupported bus configuration.
This commit is contained in:
parent
e0d0e53086
commit
ade5dae282
@ -1468,14 +1468,31 @@ qemuCheckIOThreads(const virDomainDef *def,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
/* Right "type" of disk" */
|
||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO ||
|
||||
(disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||
disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
|
||||
switch ((virDomainDiskBus)disk->bus) {
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||
disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads only available for virtio pci and "
|
||||
"virtio ccw disk"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_IDE:
|
||||
case VIR_DOMAIN_DISK_BUS_FDC:
|
||||
case VIR_DOMAIN_DISK_BUS_SCSI:
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
case VIR_DOMAIN_DISK_BUS_USB:
|
||||
case VIR_DOMAIN_DISK_BUS_UML:
|
||||
case VIR_DOMAIN_DISK_BUS_SATA:
|
||||
case VIR_DOMAIN_DISK_BUS_SD:
|
||||
case VIR_DOMAIN_DISK_BUS_LAST:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("IOThreads not available for bus %s target %s"),
|
||||
virDomainDiskBusTypeToString(disk->bus), disk->dst);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Can we find the disk iothread in the iothreadid list? */
|
||||
if (!virDomainIOThreadIDFind(def, disk->iothread)) {
|
||||
|
Loading…
Reference in New Issue
Block a user