]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: validate: Move validation of device rom
authorPeter Krempa <pkrempa@redhat.com>
Fri, 1 Oct 2021 14:47:12 +0000 (16:47 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 08:26:02 +0000 (10:26 +0200)
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>
src/qemu/qemu_command.c
src/qemu/qemu_validate.c

index 28c18f000dcd39106a77d5e2f56bb5a2071563bc..551014b5b979f0014980ab0f20f1d35d170d7d17 100644 (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) {
index 9270f40924af44b18c9b4b7c4bec1b32ea99cd2e..0bbf9208b8f8bd55bf3e275a1d89bd58a4a7cc32 100644 (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;
 }