]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuValidateDomainDefPCIFeature: Fix validation logic
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 Oct 2021 12:15:14 +0000 (14:15 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 07:41:22 +0000 (09:41 +0200)
The error that "acpi-bridge-hotplug" is not supported would be triggered
only if both the ICH9 and PIIX don't support the capability and the
machine is q35. This makes no sense.

We want to check that the appropriate platform supports the appropriate
feature.

Fixes: 7300ccc9b3e
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_validate.c

index e530368cb33f92484d8bb36d201f64204d7ee958..7eb9a37870f7f0fa69134cbd4fa0f21d2be74caf 100644 (file)
@@ -179,9 +179,6 @@ qemuValidateDomainDefPCIFeature(const virDomainDef *def,
                                 int feature)
 {
     size_t i;
-    bool q35Dom = qemuDomainIsQ35(def);
-    bool q35cap = q35Dom && virQEMUCapsGet(qemuCaps,
-                                           QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE);
 
     if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
         return 0;
@@ -198,9 +195,9 @@ qemuValidateDomainDefPCIFeature(const virDomainDef *def,
                                    virArchToString(def->os.arch));
                     return -1;
                 }
-                if (!q35cap &&
-                    !virQEMUCapsGet(qemuCaps,
-                                    QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE)) {
+
+                if ((qemuDomainIsQ35(def) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE)) ||
+                    (!qemuDomainIsQ35(def) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE))) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("acpi-bridge-hotplug is not available with this QEMU binary"));
                     return -1;