Kevin Wolf <kw...@redhat.com> writes: > From: Stefan Hajnoczi <stefa...@redhat.com> > > QMP clients can usually detect the presence of features via schema > introspection. There are rare features that do not involve schema > changes and are therefore impossible to detect with schema > introspection. > > This patch adds the query-qemu-features command. It returns a struct > containing booleans for each feature that QEMU can support. > > The decision to make this a command rather than something statically > defined in the schema is intentional. It allows QEMU to decide which > features are available at runtime, if necessary. > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > qapi/misc.json | 23 +++++++++++++++++++++++ > qmp.c | 10 ++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/qapi/misc.json b/qapi/misc.json > index 8b3ca4fdd3..d892f37633 100644 > --- a/qapi/misc.json > +++ b/qapi/misc.json > @@ -3051,3 +3051,26 @@ > 'data': 'NumaOptions', > 'allow-preconfig': true > } > + > +## > +# @QemuFeatures: > +# > +# Information about support for QEMU features that isn't available through > +# schema introspection.
This becomes incorrect the moment you apply the patch :) > +# > +# Since: 4.0 > +## > +{ 'struct': 'QemuFeatures', > + 'data': { } } > + > +## > +# @query-qemu-features: > +# > +# Return the features supported by this QEMU. Most features can be detected > +# via schema introspection but some are not observable from the schema. This > +# command offers a way to check for the presence of such features. Likewise. To be useful, the command must document each feature's extent. The feature added in the next patch is a property of the QEMU build. This means: * Running the command provides no additional information over query-qmp-schema. * You can safely cache the result for future invocations of the same QEMU build. We'll figure out implications of different feature extents once we have them. > +# > +# Since: 4.0 > +## > +{ 'command': 'query-qemu-features', > + 'returns': 'QemuFeatures' } > diff --git a/qmp.c b/qmp.c > index b92d62cd5f..0aad533eca 100644 > --- a/qmp.c > +++ b/qmp.c > @@ -717,3 +717,13 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp) > > return mem_info; > } > + > +QemuFeatures *qmp_query_qemu_features(Error **errp) > +{ > + QemuFeatures *caps = g_new(QemuFeatures, 1); > + > + *caps = (QemuFeatures) { > + }; > + > + return caps; > +}