[libvirt] [PATCH v1 05/26] qemu_command.c: move I/O APIC validation to qemu_domain.c

Daniel Henrique Barboza danielhb413 at gmail.com
Mon Dec 9 23:15:10 UTC 2019


Validation of MACHINE_KERNEL_IRQCHIP and MACHINE_KERNEL_IRQCHIP_SPLIT
QEMU caps are now being done in qemuDomainDefValidateFeatures().

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_command.c | 12 ------------
 src/qemu/qemu_domain.c  | 42 ++++++++++++++++++++++++++++++++---------
 2 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 25886bf49a..37339d6f0d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7186,20 +7186,8 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
     }
 
     if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] != VIR_DOMAIN_IOAPIC_NONE) {
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("I/O APIC tuning is not supported by this "
-                             "QEMU binary"));
-            return -1;
-        }
         switch ((virDomainIOAPIC) def->features[VIR_DOMAIN_FEATURE_IOAPIC]) {
         case VIR_DOMAIN_IOAPIC_QEMU:
-            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("split I/O APIC is not supported by this "
-                                 "QEMU binary"));
-                return -1;
-            }
             virBufferAddLit(&buf, ",kernel_irqchip=split");
             break;
         case VIR_DOMAIN_IOAPIC_KVM:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8eb0905f22..b77b3cf845 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4931,15 +4931,39 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
 
         switch ((virDomainFeature) i) {
         case VIR_DOMAIN_FEATURE_IOAPIC:
-            if (def->features[i] != VIR_DOMAIN_IOAPIC_NONE &&
-                !ARCH_IS_X86(def->os.arch)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("The '%s' feature is not supported for "
-                                 "architecture '%s' or machine type '%s'"),
-                               featureName,
-                               virArchToString(def->os.arch),
-                               def->os.machine);
-                return -1;
+            if (def->features[i] != VIR_DOMAIN_IOAPIC_NONE) {
+                if (!ARCH_IS_X86(def->os.arch)) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                   _("The '%s' feature is not supported for "
+                                     "architecture '%s' or machine type '%s'"),
+                                   featureName,
+                                   virArchToString(def->os.arch),
+                                   def->os.machine);
+                    return -1;
+                }
+
+                if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP)) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("I/O APIC tuning is not supported by "
+                                     "this QEMU binary"));
+                    return -1;
+                }
+
+                switch ((virDomainIOAPIC) def->features[i]) {
+                case VIR_DOMAIN_IOAPIC_QEMU:
+                    if (!virQEMUCapsGet(qemuCaps,
+                                        QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT)) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                       _("split I/O APIC is not supported by this "
+                                         "QEMU binary"));
+                        return -1;
+                    }
+                    break;
+                case VIR_DOMAIN_IOAPIC_KVM:
+                case VIR_DOMAIN_IOAPIC_NONE:
+                case VIR_DOMAIN_IOAPIC_LAST:
+                    break;
+                }
             }
             break;
 
-- 
2.23.0





More information about the libvir-list mailing list