[PATCH 30/33] qemu: Only default to <panic model='isa'/> on x86

Andrea Bolognani posted 33 patches 8 months, 2 weeks ago
There is a newer version of this series
[PATCH 30/33] qemu: Only default to <panic model='isa'/> on x86
Posted by Andrea Bolognani 8 months, 2 weeks ago
Other architectures generally don't have an ISA bus, so this
default never worked for them.

Since it's now possible for a specific model not to be chosen
during postparse, something that couldn't happen until now,
we need to handle the scenario by presenting the user with a
reasonable error message.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_domain.c                                   | 5 ++++-
 src/qemu/qemu_validate.c                                 | 9 ++++++++-
 .../aarch64-panic-no-model.aarch64-latest.err            | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cede7c9eb2..506f03831c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4430,7 +4430,10 @@ qemuDomainDefaultPanicModel(const virDomainDef *def)
     if (ARCH_IS_S390(def->os.arch))
         return VIR_DOMAIN_PANIC_MODEL_S390;
 
-    return VIR_DOMAIN_PANIC_MODEL_ISA;
+    if (ARCH_IS_X86(def->os.arch))
+        return VIR_DOMAIN_PANIC_MODEL_ISA;
+
+    return VIR_DOMAIN_PANIC_MODEL_DEFAULT;
 }
 
 
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 01f65c0866..db696b3d5a 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1009,8 +1009,15 @@ qemuValidateDomainDefPanic(const virDomainDef *def,
             }
             break;
 
-        /* default model value was changed before in post parse */
+        /* If a reasonable default exists for the architecture and
+         * machine type, it will have been set during postparse.
+         * Getting there means that we really need the user to
+         * provide an explicit model name */
         case VIR_DOMAIN_PANIC_MODEL_DEFAULT:
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("no model provided for panic device"));
+            return -1;
+
         case VIR_DOMAIN_PANIC_MODEL_LAST:
             break;
         }
diff --git a/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err b/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
index 8e3f2c194d..2635f23769 100644
--- a/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
+++ b/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
@@ -1 +1 @@
-unsupported configuration: the QEMU binary does not support the ISA panic device
+unsupported configuration: no model provided for panic device
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 30/33] qemu: Only default to <panic model='isa'/> on x86
Posted by Peter Krempa 8 months, 2 weeks ago
On Wed, Jan 24, 2024 at 20:37:50 +0100, Andrea Bolognani wrote:
> Other architectures generally don't have an ISA bus, so this
> default never worked for them.
> 
> Since it's now possible for a specific model not to be chosen
> during postparse, something that couldn't happen until now,
> we need to handle the scenario by presenting the user with a
> reasonable error message.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_domain.c                                   | 5 ++++-
>  src/qemu/qemu_validate.c                                 | 9 ++++++++-
>  .../aarch64-panic-no-model.aarch64-latest.err            | 2 +-
>  3 files changed, 13 insertions(+), 3 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org