[libvirt] [PATCH 10/10] qemu: caps: Don't call 'query-events' when we probe them from QMP schema

Eric Blake eblake at redhat.com
Thu Feb 7 15:56:19 UTC 2019


On 2/7/19 6:28 AM, Peter Krempa wrote:
> Avoid calling the command and fix test fallout.
> 
> Note that for clarity and size this does not include the fix to the
> numbering of commands. I've used the following command to fix them and
> it makes tests pass:
> 
> for i in tests/qemucapabilitiesdata/*.replies; do ./tests/qemucapsfixreplies $i; done
> ---
>  src/qemu/qemu_capabilities.c                  |  10 +-
>  .../caps_2.10.0.aarch64.replies               | 122 ----------------
>  .../caps_2.10.0.ppc64.replies                 | 122 ----------------
>  .../caps_2.10.0.s390x.replies                 | 122 ----------------
>  .../caps_2.10.0.x86_64.replies                | 122 ----------------
>  .../caps_2.11.0.s390x.replies                 | 122 ----------------
>  .../caps_2.11.0.x86_64.replies                | 122 ----------------
>  .../caps_2.12.0.aarch64.replies               | 128 ----------------
>  .../caps_2.12.0.ppc64.replies                 | 128 ----------------
>  .../caps_2.12.0.s390x.replies                 | 128 ----------------
>  .../caps_2.12.0.x86_64.replies                | 128 ----------------
>  .../caps_2.5.0.x86_64.replies                 | 116 ---------------
>  .../caps_2.6.0.aarch64.replies                | 122 ----------------
>  .../caps_2.6.0.ppc64.replies                  | 122 ----------------
>  .../caps_2.6.0.x86_64.replies                 | 122 ----------------
>  .../caps_2.7.0.s390x.replies                  | 122 ----------------
>  .../caps_2.7.0.x86_64.replies                 | 122 ----------------
>  .../caps_2.8.0.s390x.replies                  | 122 ----------------
>  .../caps_2.8.0.x86_64.replies                 | 122 ----------------
>  .../caps_2.9.0.ppc64.replies                  | 122 ----------------
>  .../caps_2.9.0.s390x.replies                  | 122 ----------------
>  .../caps_2.9.0.x86_64.replies                 | 122 ----------------
>  .../caps_3.0.0.ppc64.replies                  | 131 -----------------
>  .../caps_3.0.0.riscv32.replies                | 134 -----------------
>  .../caps_3.0.0.riscv64.replies                | 134 -----------------
>  .../caps_3.0.0.s390x.replies                  | 134 -----------------
>  .../caps_3.0.0.x86_64.replies                 | 134 -----------------
>  .../caps_3.1.0.ppc64.replies                  | 137 ------------------
>  .../caps_3.1.0.x86_64.replies                 | 137 ------------------
>  .../caps_4.0.0.riscv32.replies                | 137 ------------------
>  .../caps_4.0.0.riscv64.replies                | 137 ------------------
>  .../caps_4.0.0.x86_64.replies                 | 137 ------------------
>  32 files changed, 4 insertions(+), 3938 deletions(-)

Impressive diffstat! Basically, for any pre-captured qemu output new
enough to reuse introspection results, we've gotten rid of the separate
query-events reply.

> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 9c79511b1d..93a06d3cd8 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -2120,14 +2120,12 @@ virQEMUCapsProbeQMPEvents(virQEMUCapsPtr qemuCaps,
>      char **events = NULL;
>      int nevents;
> 
> -    if ((nevents = qemuMonitorGetEvents(mon, &events)) < 0)
> -        return -1;
> -
>      /* we can probe events also from the QMP schema so we can skip this here */
> -    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA)) {
> -        virStringListFreeCount(events, nevents);
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA))
>          return 0;
> -    }
> +
> +    if ((nevents = qemuMonitorGetEvents(mon, &events)) < 0)
> +        return -1;
> 
>      virQEMUCapsProcessStringFlags(qemuCaps,
>                                    ARRAY_CARDINALITY(virQEMUCapsEvents),

Reviewed-by: Eric Blake <eblake at redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190207/0fc5578d/attachment-0001.sig>


More information about the libvir-list mailing list