render / rpms / libvirt

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