Keep them along with other arch/machine type checks for features instead of waiting until command line generation time. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_command.c | 7 ------- src/qemu/qemu_domain.c | 11 ++++++++++- tests/qemuxml2argvtest.c | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 24b434a45..529079be0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7192,13 +7192,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) { if (def->gic_version != VIR_GIC_VERSION_NONE) { - if (!qemuDomainIsVirt(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("gic-version option is available " - "only for ARM virt machine")); - goto cleanup; - } - /* The default GIC version (GICv2) should not be specified on * the QEMU commandline for backwards compatibility reasons */ if (def->gic_version != VIR_GIC_VERSION_2) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dd36b42eb..98cba8789 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3252,6 +3252,16 @@ qemuDomainDefValidateFeatures(const virDomainDef *def) } break; + case VIR_DOMAIN_FEATURE_GIC: + if (def->features[i] == VIR_TRISTATE_SWITCH_ON && + !qemuDomainIsVirt(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The '%s' feature is only supported for %s guests"), + featureName, "mach-virt"); + return -1; + } + break; + case VIR_DOMAIN_FEATURE_ACPI: case VIR_DOMAIN_FEATURE_APIC: case VIR_DOMAIN_FEATURE_PAE: @@ -3264,7 +3274,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def) case VIR_DOMAIN_FEATURE_CAPABILITIES: case VIR_DOMAIN_FEATURE_PMU: case VIR_DOMAIN_FEATURE_VMPORT: - case VIR_DOMAIN_FEATURE_GIC: case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_LAST: diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c8739909d..b7afb6980 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2656,12 +2656,12 @@ mymain(void) DO_TEST_PARSE_ERROR("aarch64-gic-invalid", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-not-virt", - QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, - QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-not-arm", - QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, - QEMU_CAPS_MACH_VIRT_GIC_VERSION); + DO_TEST_PARSE_ERROR("aarch64-gic-not-virt", + QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACH_VIRT_GIC_VERSION); + DO_TEST_PARSE_ERROR("aarch64-gic-not-arm", + QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACH_VIRT_GIC_VERSION); DO_TEST("aarch64-kvm-32-on-64", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_PL011, -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list