qemu: validate: Move validation of device rom

Move the validation from 'qemuBuildRomStr' into the function which
validates device info. It was originally named
'qemuValidateDomainDeviceDefAddress' but this commit renames it to
'qemuValidateDomainDeviceDefInfo'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-10-01 16:47:12 +02:00
parent 98a574ca0d
commit 24be92b8e3
2 changed files with 8 additions and 6 deletions

View File

@ -1055,12 +1055,6 @@ qemuBuildRomStr(virBuffer *buf,
virDomainDeviceInfo *info)
{
if (info->romenabled || info->rombar || info->romfile) {
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("ROM tuning is only supported for PCI devices"));
return -1;
}
/* Passing an empty romfile= tells QEMU to disable ROM entirely for
* this device, and makes other settings irrelevant */
if (info->romenabled == VIR_TRISTATE_BOOL_NO) {

View File

@ -1403,6 +1403,14 @@ qemuValidateDomainDeviceInfo(const virDomainDeviceDef *dev,
}
}
if (info->romenabled || info->rombar || info->romfile) {
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ROM tuning is only supported for PCI devices"));
return -1;
}
}
return 0;
}