qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] qmp: Add query-qemu-features


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 1/2] qmp: Add query-qemu-features
Date: Thu, 28 Mar 2019 19:28:09 +0100

From: Stefan Hajnoczi <address@hidden>

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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 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.
+#
+# 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.
+#
+# 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;
+}
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]