[PATCH] qemu_domain: tolerate ACPI feature on S390

Boris Fiuczynski posted 1 patch 3 months ago
src/qemu/qemu_domain.c | 10 ++++++++++
1 file changed, 10 insertions(+)
[PATCH] qemu_domain: tolerate ACPI feature on S390
Posted by Boris Fiuczynski 3 months ago
Migrations of S390 domains from hosts with QEMU supporting ACPI and a
libvirt version prior 9.1.0 fail when the destination host runs a QEMU
not supporting ACPI and a libvirt version 9.1.0 or older. Actually S390
never supported ACPI but domains were allowed to have the feature ACPI
enabled and it was silently tolerated. To allow migration from libvirt
versions prior 9.1.0 which allowed the ACPI feature to be used on S390
tolerate ACPI by setting it to absent if specified and QEMU does not
support it.

Resolves: https://issues.redhat.com/browse/RHEL-49516
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
---
 src/qemu/qemu_domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 198ab99aef..fbc336ac66 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4499,6 +4499,16 @@ qemuDomainDefEnableDefaultFeatures(virDomainDef *def,
          * capabilities, we still want to enable this */
         def->features[VIR_DOMAIN_FEATURE_GIC] = VIR_TRISTATE_SWITCH_ON;
     }
+
+    /* To support migration from libvirt versions prio 9.1.0 which allowed
+     * the ACPI feature to be used on S390 tolerate ACPI by setting it to
+     * absent if specified and QEMU does not support it */
+    if (ARCH_IS_S390(def->os.arch) &&
+        def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ABSENT &&
+        virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) == VIR_TRISTATE_BOOL_NO) {
+        VIR_DEBUG("Tolerate ACPI on S390 by removing the ACPI feature");
+        def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT;
+    }
 }
 
 
-- 
2.45.0
Re: [PATCH] qemu_domain: tolerate ACPI feature on S390
Posted by Peter Krempa 3 months ago
On Wed, Jul 31, 2024 at 12:36:43 +0200, Boris Fiuczynski wrote:
> Migrations of S390 domains from hosts with QEMU supporting ACPI and a
> libvirt version prior 9.1.0 fail when the destination host runs a QEMU
> not supporting ACPI and a libvirt version 9.1.0 or older. Actually S390
> never supported ACPI but domains were allowed to have the feature ACPI
> enabled and it was silently tolerated. To allow migration from libvirt
> versions prior 9.1.0 which allowed the ACPI feature to be used on S390
> tolerate ACPI by setting it to absent if specified and QEMU does not
> support it.
> 
> Resolves: https://issues.redhat.com/browse/RHEL-49516
> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
> ---
>  src/qemu/qemu_domain.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

I'll be posting very soon a version that adds more explanation and has
tests so please have a look at that one.

It does effectively the same thing to hack around the broken s390
configs ...


> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 198ab99aef..fbc336ac66 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4499,6 +4499,16 @@ qemuDomainDefEnableDefaultFeatures(virDomainDef *def,

... but in a more appropriate location.

>           * capabilities, we still want to enable this */
>          def->features[VIR_DOMAIN_FEATURE_GIC] = VIR_TRISTATE_SWITCH_ON;
>      }
> +
> +    /* To support migration from libvirt versions prio 9.1.0 which allowed
> +     * the ACPI feature to be used on S390 tolerate ACPI by setting it to
> +     * absent if specified and QEMU does not support it */

... also explaining that the configs users were providing were broken
the whole time and also that some other arches may suffer from the same
problem but are deliberately not fixed.

> +    if (ARCH_IS_S390(def->os.arch) &&
> +        def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ABSENT &&
> +        virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) == VIR_TRISTATE_BOOL_NO) {
> +        VIR_DEBUG("Tolerate ACPI on S390 by removing the ACPI feature");
> +        def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT;
> +    }
>  }
>  
>  
> -- 
> 2.45.0
>