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

Re: [Xen-devel] [PATCH v2 1/4] qapi: net: Add query-netdevs command



Alexey Kirillov <lekiravi@xxxxxxxxxxxxxx> writes:

> Add a qmp command that provides information about currently attached
> network devices and their configuration.

Closes a gap in QMP; appreciated!

> Signed-off-by: Alexey Kirillov <lekiravi@xxxxxxxxxxxxxx>
[...]
> diff --git a/qapi/net.json b/qapi/net.json
> index 1cb9a7d782..4f329a1de0 100644
> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -750,3 +750,92 @@
>  ##
>  { 'event': 'FAILOVER_NEGOTIATED',
>    'data': {'device-id': 'str'} }
> +
> +##
> +# @NetdevInfo:
> +#
> +# Configuration of a network device.
> +#
> +# @id: Device identifier.
> +#
> +# @type: Specify the driver used for interpreting remaining arguments.
> +#
> +# @peer: Connected network device.

@peer is optional.  I assume its present when the device is connected
(frontend to backend or vice versa).  Correct?

> +#
> +# @queues-count: Number of queues.

We use plain @queues elsewhere in the schema.

> +#
> +# @hub: hubid of hub, if connected to.

How @hub is related to @peer is not quite obvious to me.  Can you give
an example where @hub is present?

> +#
> +# @perm-mac: Original MAC address.

What does "perm-" mean?

It's optional.  When exactly is it present?

> +#
> +# Since: 5.0
> +##
> +{ 'union': 'NetdevInfo',
> +  'base': { 'id': 'str',
> +            'type': 'NetClientDriver',
> +            '*peer': 'str',
> +            'queues-count': 'int',
> +            '*hub': 'int',
> +            '*perm-mac': 'str' },
> +  'discriminator': 'type',
> +  'data': {
> +      'nic':        'NetLegacyNicOptions',
> +      'user':       'NetdevUserOptions',
> +      'tap':        'NetdevTapOptions',
> +      'l2tpv3':     'NetdevL2TPv3Options',
> +      'socket':     'NetdevSocketOptions',
> +      'vde':        'NetdevVdeOptions',
> +      'bridge':     'NetdevBridgeOptions',
> +      'hubport':    'NetdevHubPortOptions',
> +      'netmap':     'NetdevNetmapOptions',
> +      'vhost-user': 'NetdevVhostUserOptions' } }

This is a copy of union 'Netdev' with a few additional common members
(@peer, @queues-count, @hub, @perm-mac).  I can't see how to avoid the
duplication without adding nesting on the wire.

> +
> +##
> +# @query-netdevs:
> +#
> +# Get a list of @NetdevInfo for all virtual network devices.
> +#
> +# Returns: a list of @NetdevInfo describing each virtual network device.
> +#
> +# Since: 5.0
> +#
> +# Example:
> +#
> +# -> { "execute": "query-netdevs" }
> +# <- { "return": [
> +#          {
> +#              "peer": "netdev0",
> +#              "netdev": "netdev0",
> +#              "perm-mac": "52:54:00:12:34:56"
> +#              "model": "virtio-net-pci",
> +#              "macaddr": "52:54:00:12:34:56",
> +#              "queues-count": 1,
> +#              "type": "nic",
> +#              "id": "net0"
> +#          },
> +#          {
> +#              "peer": "net0",
> +#              "ipv6": true,
> +#              "ipv4": true,
> +#              "host": "10.0.2.2",
> +#              "queues-count": 1,
> +#              "ipv6-dns": "fec0::3",
> +#              "ipv6-prefix": "fec0::",
> +#              "net": "10.0.2.0/255.255.255.0",
> +#              "ipv6-host": "fec0::2",
> +#              "type": "user",
> +#              "dns": "10.0.2.3",
> +#              "hostfwd": [
> +#                  {
> +#                      "str": "tcp::20004-:22"
> +#                  }
> +#              ],
> +#              "ipv6-prefixlen": 64,
> +#              "id": "netdev0",
> +#              "restrict": false
> +#          }
> +#      ]
> +#    }
> +#
> +##
> +{ 'command': 'query-netdevs', 'returns': ['NetdevInfo'] }

Like HMP "info network" and -net, this mixes frontends ("type": "nic")
and backends.  Unlike query-chardev and query-block.  Hmm.

A long time ago, all we had was -net: "-net nic" for configuring
frontends, "-net none" for suppressing a default frontend + backend, and
"-net anything-else" for configuring backends.  "info network" showed
the stuff set up with -net.

In v0.12, we got -device for configuring frontends, and -netdev for
backends.  -netdev is like -net less "none", "nic", and the hub
weirdness.  "info network" was extended to also show all this.

In v2.12, we got -nic, replacing -net nic.

Unless I'm missing something, -net is just for backward compatibility
now.

What's the use case for query-networks reporting frontends?


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.