[libvirt PATCH] qemu: do not compare missing cpu data

Jiri Denemark jdenemar at redhat.com
Wed Dec 8 13:08:01 UTC 2021


On Wed, Dec 08, 2021 at 13:24:04 +0100, Ján Tomko wrote:
> For x86, we invalidate qemu caps cache if the host CPUID changed.
> However other cpu drivers do not have the 'getHostData' function
> implemented.
> 
> Skip the comparison if we do not have host CPUData available,
> since virCPUDataIsIdentical always returns an error in that case.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=2030119
> 
> Fixes: 3bc6f46d305ed82f7314ffc4c2a66847b831a6bd
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 0e6e73774a..51828ead53 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4943,7 +4943,8 @@ virQEMUCapsIsValid(void *data,
>              return false;
>          }
>  
> -        if (virCPUDataIsIdentical(priv->cpuData, qemuCaps->cpuData) !=
> +        if (priv->cpuData &&
> +            virCPUDataIsIdentical(priv->cpuData, qemuCaps->cpuData) !=
>              VIR_CPU_COMPARE_IDENTICAL) {

While at it you could have placed VIR_CPU_COMPARE_IDENTICAL at the end
of the previous line.

>              VIR_DEBUG("Outdated capabilities for '%s': host cpuid changed",
>                        qemuCaps->binary);

Reviewed-by: Jiri Denemark <jdenemar at redhat.com>




More information about the libvir-list mailing list