From 2453950da62d87795917d41a6c58d20d5587b45c Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Mon, 9 Dec 2019 20:15:10 -0300 Subject: [PATCH] qemu: command: move I/O APIC validation to qemu_domain.c Validation of MACHINE_KERNEL_IRQCHIP and MACHINE_KERNEL_IRQCHIP_SPLIT QEMU caps are now being done in qemuDomainDefValidateFeatures(). Reviewed-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- 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 e7365ba86a..6446fe29a6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7191,20 +7191,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 895b52bb07..93c6af3bc6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5062,15 +5062,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; -- GitLab