[libvirt] [PATCH] qemu: allow QMP probing of CPU definitions to fail

Jiri Denemark jdenemar at redhat.com
Thu Mar 16 09:14:54 UTC 2017


On Thu, Mar 16, 2017 at 09:41:42 +0100, Guido Günther wrote:
> This unbreaks emulators that don't support this command such as
> qemu-system-mips*.
> 
> Reference: http://bugs.debian.org/854125
> ---
>  src/qemu/qemu_capabilities.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 70f9ed777..207deedbb 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -2793,7 +2793,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
>      size_t i;
>  
>      if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0)
> -        return -1;
> +        return 0;
>  
>      if (!(models = virDomainCapsCPUModelsNew(ncpus)))
>          goto cleanup;

The fix is not correct because we don't want to ignore all errors.

There are two options how to fix this bug:

- you can add a new capability associated with the command and return
  from virQEMUCapsProbeQMPCPUDefinitions if this capability is not set,

- or just add qemuMonitorJSONHasError(reply, "CommandNotFound") in
  qemuMonitorJSONGetCPUDefinitions to the if statement which already
  checks for GenericError.

I think the capability is slightly better.

Jirka




More information about the libvir-list mailing list