]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Relax os.loader->type check when validating domain
authorMichal Privoznik <mprivozn@redhat.com>
Sat, 13 Jul 2019 07:17:06 +0000 (09:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Jul 2019 11:24:09 +0000 (13:24 +0200)
When validating a domain among all the checks there are two that
concern VIR_DOMAIN_LOADER_TYPE_PFLASH specifically. The first
check ensures that on x86 ACPI is enabled when UEFI is requested,
the second ensures that UEFI is used when ACPI is requested on
aarch64. However, check for UEFI is done by plain comparison of
def->os.loader->type which is insufficient because we have
def->os.firmware too.

NB, this wouldn't be a problem for active domain, because on
startup process def->os.loader->type gets filled by
qemuFirmwareEnableFeatures(), but that's not the case for
inactive domains.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1729604
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml

index 00ac5e130768cbc28fbbb0fd77355a58ad56e190..670b928c4ccfa4084d0111abf1a58339b335d197 100644 (file)
@@ -4221,8 +4221,9 @@ qemuDomainDefValidate(const virDomainDef *def,
     }
 
     /* On x86, UEFI requires ACPI */
-    if (def->os.loader &&
-        def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH &&
+    if ((def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI ||
+         (def->os.loader &&
+          def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH)) &&
         ARCH_IS_X86(def->os.arch) &&
         def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4233,8 +4234,9 @@ qemuDomainDefValidate(const virDomainDef *def,
     /* On aarch64, ACPI requires UEFI */
     if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON &&
         def->os.arch == VIR_ARCH_AARCH64 &&
-        (!def->os.loader ||
-         def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) {
+        (def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_EFI &&
+         (!def->os.loader ||
+          def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH))) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("ACPI requires UEFI on this architecture"));
         goto cleanup;
index 9821e283586043f67abd076b48e50edea6953702..3914b6bf6ea9ab191caf715f8a5b1ce8d7259efd 100644 (file)
@@ -29,7 +29,6 @@ format=raw,unit=1 \
 -mon chardev=charmonitor,id=monitor,mode=control \
 -rtc base=utc \
 -no-shutdown \
--no-acpi \
 -boot strict=on \
 -kernel /aarch64.kernel \
 -initrd /aarch64.initrd \
index c3e25f305260369d02916e4d7fc55f763585dc27..48605f7198c239036e8a25b723efc6bfdebe0802 100644 (file)
@@ -13,6 +13,7 @@
     <boot dev='hd'/>
   </os>
   <features>
+    <acpi/>
     <apic/>
     <pae/>
     <gic version='2'/>
index 529ce6f3c203545a0332ade2079cee7b8741947b..1e51d55305e1188d8c322462ddce578d8c850048 100644 (file)
@@ -13,6 +13,7 @@
     <boot dev='hd'/>
   </os>
   <features>
+    <acpi/>
     <apic/>
     <pae/>
     <gic version='2'/>