[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH 1/8] libxl: Replace deprecated QMP command by "query-cpus-fast"
On Fri, Apr 23, 2021 at 12:16 PM Anthony PERARD <anthony.perard@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > > 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@xxxxxxxxx>
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |