On 05/02/2018 02:30 AM, Fam Zheng wrote:
HMP "info usernet" has been available but it isn't ideal for programmed
use cases. This closes the gap in QMP by adding a counterpart
"query-usernet" command. It is basically translated from
the HMP slirp_connection_info() loop, which now calls the QMP
implementation and prints the data, just like other HMP info_* commands.
The TCPS_* macros are now defined as a QAPI enum.
Signed-off-by: Fam Zheng <f...@redhat.com>
---
+##
+# @UsernetInfo:
+#
+# SLIRP usernet information.
+#
+# Since: 2.13
+##
+{ 'struct': 'UsernetInfo',
+ 'data': {
+ 'id': 'str',
+ 'hub': 'int',
+ 'connections': ['UsernetConnection']
+} }
+
+##
+# @query-usernet:
+#
+# Return SLIRP network information.
+#
+# Since: 2.13
+#
+# Example:
+#
+# -> { "execute": "query-usernet", "arguments": { } }
+# <- { "return": [
+# {
+# "promiscuous": true,
+# "name": "vnet0"
That example looks wrong; I'm expecting 'id', 'hub', and another array
'connections'.
+# }
+# ]
+# }
+#
+##
+{ 'command': 'query-usernet',
+ 'returns': ['UsernetInfo'] }
Other than the botched example, the qapi additions look okay to me.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org