render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
b971b8
From a809e7c5200c4089153768a047f85add0205c4bc Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <a809e7c5200c4089153768a047f85add0205c4bc@dist-git>
b971b8
From: Daniel Henrique Barboza <danielhb413@gmail.com>
b971b8
Date: Mon, 30 Mar 2020 17:18:27 -0400
b971b8
Subject: [PATCH] qemu: avoid launching non-x86 guests with APIC-EOI setting
b971b8
b971b8
The "<apic/>" feature, although it's available only for x86 guests,
b971b8
can be declared in the domain XML of other archs without errors.
b971b8
But setting its 'eoi' attribute will break QEMU. For "<apic eoi='on'/>",
b971b8
in a ppc64 guest:
b971b8
b971b8
qemu-kvm: Expected key=value format, found +kvm_pv_eoi
b971b8
b971b8
A similar error happens with eoi='off'.
b971b8
b971b8
One can argue that it's better to simply forbid launching non-x86
b971b8
guests with "<apic/>" declared in the XML - it is a feature that
b971b8
the architecture doesn't support and this would make it clearer
b971b8
about it. This is sensible, but there are non-x86 guests that are
b971b8
running with "<apic/>" declared in the domain (and A LOT of guests
b971b8
running with "<acpi/>" for that matter, probably reminiscent of x86
b971b8
templates that were reused for other archs) that will stop working if we
b971b8
go this route.
b971b8
b971b8
A more subtle approach is to detect if the 'eoi' element is being set
b971b8
for non-x86 guests and warn the user about it with a better error
b971b8
message than the one QEMU provides. This is the new error message
b971b8
when any value is set for the 'eoi' element in a ppc64 XML:
b971b8
b971b8
error: unsupported configuration: The 'eoi' attribute of the 'apic'
b971b8
feature is not supported for architecture 'ppc64' or machine type
b971b8
'pseries'.
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1236440
b971b8
b971b8
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
b971b8
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
b971b8
(cherry picked from commit dbda73ff27cf185fb5db498cc4db281b2d76778d)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1829729
b971b8
b971b8
Signed-off-by: Daniel Henrique Barboza <dbarboza@redhat.com>
b971b8
Message-Id: <20200330211827.951474-2-dbarboza@redhat.com>
b971b8
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
b971b8
---
b971b8
 src/qemu/qemu_domain.c | 17 ++++++++++++++++-
b971b8
 1 file changed, 16 insertions(+), 1 deletion(-)
b971b8
b971b8
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
b971b8
index bb28716ff0..8f746cdf13 100644
b971b8
--- a/src/qemu/qemu_domain.c
b971b8
+++ b/src/qemu/qemu_domain.c
b971b8
@@ -5279,8 +5279,23 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
b971b8
             }
b971b8
             break;
b971b8
 
b971b8
-        case VIR_DOMAIN_FEATURE_ACPI:
b971b8
         case VIR_DOMAIN_FEATURE_APIC:
b971b8
+            /* The kvm_pv_eoi feature is x86-only. */
b971b8
+            if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
b971b8
+                def->apic_eoi != VIR_TRISTATE_SWITCH_ABSENT &&
b971b8
+                !ARCH_IS_X86(def->os.arch)) {
b971b8
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
b971b8
+                               _("The 'eoi' attribute of the '%s' feature "
b971b8
+                                 "is not supported for architecture '%s' or "
b971b8
+                                 "machine type '%s'"),
b971b8
+                                 featureName,
b971b8
+                                 virArchToString(def->os.arch),
b971b8
+                                 def->os.machine);
b971b8
+                 return -1;
b971b8
+            }
b971b8
+            break;
b971b8
+
b971b8
+        case VIR_DOMAIN_FEATURE_ACPI:
b971b8
         case VIR_DOMAIN_FEATURE_PAE:
b971b8
         case VIR_DOMAIN_FEATURE_HAP:
b971b8
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
b971b8
-- 
b971b8
2.26.2
b971b8