xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jason Andryuk <jandryuk@gmail.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <iwj@xenproject.org>,  Wei Liu <wl@xen.org>
Subject: Re: [XEN PATCH 1/8] libxl: Replace deprecated QMP command by "query-cpus-fast"
Date: Wed, 28 Apr 2021 12:53:12 -0400	[thread overview]
Message-ID: <CAKf6xpuDQuUbJ+Gn9OHNU6BXb2Rm+Bdv7hPNtMxcX1CA4d_aYA@mail.gmail.com> (raw)
In-Reply-To: <20210423161558.224367-2-anthony.perard@citrix.com>

On Fri, Apr 23, 2021 at 12:16 PM Anthony PERARD
<anthony.perard@citrix.com> wrote:
>
> We use the deprecated QMP command "query-cpus" which is removed in the
> QEMU 6.0 release. There's a replacement which is "query-cpus-fast",
> and have been available since QEMU 2.12 (April 2018).
>
> This patch try the new command first and when the command isn't
> available, it fall back to the deprecated one so libxl still works
> with older QEMU versions.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>
> Notes:
>     This is v2 of '[XEN PATCH for-4.15] libxl: Replace deprecated QMP
>     command by "query-cpus-fast"' as the patch never made it into the
>     release.
>
>     changes:
>     - introduce a fallback for when the new command isn't available.
>
>  tools/libs/light/libxl_domain.c | 103 ++++++++++++++++++++++++++++++--
>  1 file changed, 98 insertions(+), 5 deletions(-)
>
> diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
> index 5d4ec9071160..8c003aa7cb04 100644
> --- a/tools/libs/light/libxl_domain.c
> +++ b/tools/libs/light/libxl_domain.c
> @@ -1740,6 +1740,35 @@ static int libxl__set_vcpuonline_xenstore(libxl__gc *gc, uint32_t domid,
>      return rc;
>  }
>
> +static int qmp_parse_query_cpus_fast(libxl__gc *gc,
> +                                     libxl_domid domid,
> +                                     const libxl__json_object *response,
> +                                     libxl_bitmap *const map)
> +{
> +    int i;
> +    const libxl__json_object *cpu;
> +
> +    libxl_bitmap_set_none(map);
> +    /* Parse response to QMP command "query-cpus-fast":
> +     * [ { 'cpu-index': 'int',...} ]
> +     */
> +    for (i = 0; (cpu = libxl__json_array_get(response, i)); i++) {
> +        unsigned int cpu_index;
> +        const libxl__json_object *o;
> +
> +        o = libxl__json_map_get("cpu-index", cpu, JSON_INTEGER);

Looks like qmp_parse_query_cpus_fast and qmp_parse_query_cpus just
differ by the key string.  So you could pass it in as an argument -
maybe with qmp_parse_query_cpus_fast and qmp_parse_query_cpus as
wrappers around a common implementation?

But if you prefer this separate function, it's fine.

Reviewed-by: Jason Andryuk <jandryuk@gmail.com>


  reply	other threads:[~2021-04-28 16:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 16:15 [XEN PATCH 0/8] Fix libxl with QEMU 6.0 + remove some more deprecated usages Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 1/8] libxl: Replace deprecated QMP command by "query-cpus-fast" Anthony PERARD
2021-04-28 16:53   ` Jason Andryuk [this message]
2021-05-10 14:11     ` Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 2/8] libxl: Replace QEMU's command line short-form boolean option Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 3/8] libxl: Replace deprecated "cpu-add" QMP command by "device_add" Anthony PERARD
2021-05-03 13:47   ` Jason Andryuk
2021-04-23 16:15 ` [XEN PATCH 4/8] libxl: Use -device for cd-rom drives Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 5/8] libxl: Assert qmp_ev's state in qmp_ev_qemu_compare_version Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 6/8] libxl: Export libxl__qmp_ev_qemu_compare_version Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 7/8] libxl: Use `id` with the "eject" QMP command Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 8/8] libxl: Replace QMP command "change" by "blockdev-change-media" Anthony PERARD
2021-05-03 14:13 ` [XEN PATCH 0/8] Fix libxl with QEMU 6.0 + remove some more deprecated usages Jason Andryuk
2021-05-10 14:17   ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKf6xpuDQuUbJ+Gn9OHNU6BXb2Rm+Bdv7hPNtMxcX1CA4d_aYA@mail.gmail.com \
    --to=jandryuk@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [XEN PATCH 1/8] libxl: Replace deprecated QMP command by "query-cpus-fast"' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).