]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Validate presence of PCI support
authorAndrea Bolognani <abologna@redhat.com>
Fri, 11 Jul 2025 13:38:37 +0000 (15:38 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 6 Oct 2025 09:15:44 +0000 (11:15 +0200)
The qemuValidateDomainDeviceDefControllerPCI() function is
called if PCI controllers are present in the domain
configuration, which shouldn't happen if the machine type
doesn't support PCI. If we somehow find ourselves in that
scenario, reporting an error would be the right thing to do.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_validate.c

index c7ecb467a3b5e6a44fafd57810618ac54c256b0a..456f9ee2f21ec15ec5bbf65a8c07cc5c08b825cf 100644 (file)
@@ -3983,6 +3983,13 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
         return -1;
     }
 
+    if (!qemuDomainSupportsPCI(def)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Machine type '%1$s' does not support PCI"),
+                       def->os.machine);
+        return -1;
+    }
+
     /* modelName */
     switch ((virDomainControllerModelPCI) cont->model) {
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: