diff options
author | Alexey Kirillov <lekiravi@yandex-team.ru> | 2021-03-03 12:59:06 +0300 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2021-03-15 16:41:22 +0800 |
commit | d32ad10a14d46dfe9304e3ed5858a11dcd5c71a0 (patch) | |
tree | e56aaddf5e86dd29209ce958e94c0d91ad950778 /qapi | |
parent | 3aa1b7af0f5fbfdf1b4759658e1445bda680b40d (diff) |
qapi: net: Add query-netdev command
The query-netdev command is used to get the configuration of the current
network device backends (netdevs).
This is the QMP analog of the HMP command "info network" but only for
netdevs (i.e. excluding NIC and hubports).
The query-netdev command returns an array of objects of the NetdevInfo
type, which are an extension of Netdev type. It means that response can
be used for netdev-add after small modification. This can be useful for
recreate the same netdev configuration.
Information about the network device is filled in when it is created or
modified and is available through the NetClientState->stored_config.
Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/net.json | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/qapi/net.json b/qapi/net.json index c31748c87f..87361ebd9a 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -714,3 +714,83 @@ ## { 'event': 'FAILOVER_NEGOTIATED', 'data': {'device-id': 'str'} } + +## +# @NetBackend: +# +# Available netdev backend drivers. +# +# Since: 6.0 +## +{ 'enum': 'NetBackend', + 'data': [ 'bridge', 'l2tpv3', 'netmap', 'socket', 'tap', 'user', 'vde', + 'vhost-user', 'vhost-vdpa' ] } + +## +# @NetdevInfo: +# +# Configuration of a network backend device (netdev). +# +# @id: Device identifier. +# +# @type: Specify the driver used for interpreting remaining arguments. +# +# @peer-id: The connected frontend network device name (absent if no frontend +# is connected). +# +# Since: 6.0 +## +{ 'union': 'NetdevInfo', + 'base': { 'id': 'str', + 'type': 'NetBackend', + '*peer-id': 'str' }, + 'discriminator': 'type', + 'data': { + 'bridge': 'NetdevBridgeOptions', + 'l2tpv3': 'NetdevL2TPv3Options', + 'netmap': 'NetdevNetmapOptions', + 'socket': 'NetdevSocketOptions', + 'tap': 'NetdevTapOptions', + 'user': 'NetdevUserOptions', + 'vde': 'NetdevVdeOptions', + 'vhost-user': 'NetdevVhostUserOptions', + 'vhost-vdpa': 'NetdevVhostVDPAOptions' } } + +## +# @query-netdev: +# +# Get a list of @NetdevInfo for all virtual network backend devices (netdevs). +# +# Returns: a list of @NetdevInfo describing each netdev. +# +# Since: 6.0 +# +# Example: +# +# -> { "execute": "query-netdev" } +# <- { "return": [ +# { +# "ipv6": true, +# "ipv4": true, +# "host": "10.0.2.2", +# "ipv6-dns": "fec0::3", +# "ipv6-prefix": "fec0::", +# "net": "10.0.2.0/255.255.255.0", +# "ipv6-host": "fec0::2", +# "type": "user", +# "peer-id": "net0", +# "dns": "10.0.2.3", +# "hostfwd": [ +# { +# "str": "tcp::20004-:22" +# } +# ], +# "ipv6-prefixlen": 64, +# "id": "netdev0", +# "restrict": false +# } +# ] +# } +# +## +{ 'command': 'query-netdev', 'returns': ['NetdevInfo'] } |