mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemuValidateDomainDeviceDefDiskFrontend: Aggregate disk iomode validation
Move the two checks under a common block. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
217e1527e9
commit
108676c225
@ -2861,12 +2861,28 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
||||
}
|
||||
}
|
||||
|
||||
if (disk->iomode == VIR_DOMAIN_DISK_IO_NATIVE &&
|
||||
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DIRECTSYNC &&
|
||||
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("io='native' needs either no disk cache or directsync cache mode"));
|
||||
return -1;
|
||||
switch (disk->iomode) {
|
||||
case VIR_DOMAIN_DISK_IO_NATIVE:
|
||||
if (disk->cachemode != VIR_DOMAIN_DISK_CACHE_DIRECTSYNC &&
|
||||
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("io='native' needs either no disk cache or directsync cache mode"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_IO_URING:
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("io uring is not supported by this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_IO_THREADS:
|
||||
case VIR_DOMAIN_DISK_IO_DEFAULT:
|
||||
case VIR_DOMAIN_DISK_IO_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
if (disk->serial &&
|
||||
@ -2892,14 +2908,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (disk->iomode == VIR_DOMAIN_DISK_IO_URING) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("io uring is not supported by this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (disk->serial &&
|
||||
qemuValidateDomainDeviceDefDiskSerial(disk->serial) < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user