summaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2026-08-28 16:04:07 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2026-08-29 12:07:43 +0400
commit8cb95c6126d6e72a73e983eed47ecb5a95e3248e (patch)
tree4e3e96bd2d924019ef15f8a45348fa5c29b4a764 /qapi
parentea86b6c69fe7bd12a05f47c7d4e071862ea9b9f2 (diff)
downloadqemu-8cb95c6126d6e72a73e983eed47ecb5a95e3248e.tar.gz
qemu-8cb95c6126d6e72a73e983eed47ecb5a95e3248e.zip
net/qapi: add x-query-usernet command
Add a QMP command to query user-mode network stack (slirp) connection states, providing a structured alternative to "info usernet" HMP. The new command returns a list of UsernetInfo, with hub-id, hub-name, and connection info for each slirp stack. It is marked unstable as it is meant for debugging. Rewrite hmp_info_usernet() as a thin wrapper over qmp_x_query_usernet() so the HMP and QMP paths share the same implementation. This is part of the effort to decouple HMP from QEMU core. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-10-9227de146347@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/net.json44
1 files changed, 44 insertions, 0 deletions
diff --git a/qapi/net.json b/qapi/net.json
index 1a6382825c..5d3342fba2 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -1261,3 +1261,47 @@
##
{ 'event': 'NETDEV_VHOST_USER_DISCONNECTED',
'data': { 'netdev-id': 'str' } }
+
+##
+# @UsernetInfo:
+#
+# Information about a user-mode network stack (slirp).
+#
+# @hub-id: The hub id, if available.
+#
+# @hub-name: The name of the hub.
+#
+# @info: Network information from slirp.
+#
+# Since: 11.2
+##
+{ 'struct': 'UsernetInfo',
+ 'data': {
+ '*hub-id': 'int',
+ 'hub-name': 'str',
+ 'info': 'str' },
+ 'if': 'CONFIG_SLIRP' }
+
+##
+# @x-query-usernet:
+#
+# Query user-mode network stack connection states.
+#
+# Features:
+#
+# @unstable: This command is meant for debugging.
+#
+# Returns: list of user-mode network stack information.
+#
+# Since: 11.2
+#
+# .. qmp-example::
+#
+# -> { "execute": "x-query-usernet" }
+# <- { "return": [ { "hub-id": 0, "hub-name": "vnet",
+# "info": "..." } ] }
+##
+{ 'command': 'x-query-usernet',
+ 'returns': ['UsernetInfo'],
+ 'if': 'CONFIG_SLIRP',
+ 'features': [ 'unstable' ] }