From: Peter Krempa Date: Fri, 1 Oct 2021 14:47:12 +0000 (+0200) Subject: qemu: validate: Move validation of device rom X-Git-Tag: v7.9.0-rc1~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24be92b8e38762e9ba13e32a4f68568ed26380ea;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 28c18f000d..551014b5b9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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) { diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 9270f40924..0bbf9208b8 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -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; }