On 11/10/21 07:03, Markus Armbruster wrote:
Jonah Palmer<jonah.pal...@oracle.com> writes:
From: Laurent Vivier<lviv...@redhat.com>
This new command lists all the instances of VirtIODevice with
their QOM paths and virtio type/name.
Signed-off-by: Jonah Palmer<jonah.pal...@oracle.com>
[...]
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 4912b97..1512ada 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -93,3 +93,4 @@
{ 'include': 'audio.json' }
{ 'include': 'acpi.json' }
{ 'include': 'pci.json' }
+{ 'include': 'virtio.json' }
diff --git a/qapi/virtio.json b/qapi/virtio.json
new file mode 100644
index 0000000..324ba8c
--- /dev/null
+++ b/qapi/virtio.json
@@ -0,0 +1,55 @@
+# -*- Mode: Python -*-
+# vim: filetype=python
+#
+
+##
+# = Virtio devices
+##
+
+##
+# @VirtioInfo:
+#
+# Basic information about a given VirtIODevice
+#
+# @path: the device's canonical QOM path
+#
+# @type: VirtIO device name
+#
+# Since: 6.3
I expect the next release to be numbered 7.0.
Got it. I'll update this for next series.
+#
+##
+{ 'struct': 'VirtioInfo',
+ 'data': { 'path': 'str',
+ 'type': 'str' } }
+
+##
+# @x-query-virtio:
+#
+# Returns a list of all realized VirtIO devices
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: list of gathered @VirtioInfo devices
+#
+# Since: 6.3
+#
+# Example:
+#
+# -> { "execute": "x-query-virtio" }
+# <- { "return": [ { "path":
"/machine/peripheral-anon/device[4]/virtio-backend",
+# "type": "virtio-input" },
+# { "path": "/machine/peripheral/crypto0/virtio-backend",
+# "type": "virtio-crypto" },
+# { "path":
"/machine/peripheral-anon/device[2]/virtio-backend",
+# "type": "virtio-scsi" },
+# { "path":
"/machine/peripheral-anon/device[1]/virtio-backend",
+# "type": "virtio-net" },
+# { "path":
"/machine/peripheral-anon/device[0]/virtio-backend",
+# "type": "virtio-serial" }
+# ] }
Any particular reason for reformatting the example? For what it's
worth, I'd prefer the previous version.
Aside: consistent formatting of examples would be nice. Not in this
series.
I think I got a little too excited reformatting. I'll revert the examples back
to
their original format and make sure the rest of the examples throughout the
entire
series are consistent with each other.
+#
+##
+
+{ 'command': 'x-query-virtio', 'returns': ['VirtioInfo'],
+ 'features': [ 'unstable' ] }
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index 7f103ea..fd00ee2 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -103,6 +103,7 @@ static bool query_is_ignored(const char *cmd)
"query-gic-capabilities", /* arm */
/* Success depends on target-specific build configuration: */
"query-pci", /* CONFIG_PCI */
+ "x-query-virtio", /* CONFIG_VIRTIO */
/* Success depends on launching SEV guest */
"query-sev-launch-measure",
/* Success depends on Host or Hypervisor SEV support */