[PATCH 0/2] Introducing QMP query-netdevs command

Alexey Kirillov posted 2 patches 4 years, 5 months ago
Test asan passed
Test checkpatch passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191113212516.13606-1-lekiravi@yandex-team.ru
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Luigi Rizzo <rizzo@iet.unipi.it>, Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Markus Armbruster <armbru@redhat.com>, Stefan Weil <sw@weilnetz.de>, Vincenzo Maffione <v.maffione@gmail.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Eric Blake <eblake@redhat.com>, Jason Wang <jasowang@redhat.com>
There is a newer version of this series
include/net/net.h          |   1 +
net/hub.c                  |   8 +++
net/l2tpv3.c               |  19 ++++++
net/net.c                  |  80 +++++++++++++++++++++++
net/netmap.c               |  13 ++++
net/slirp.c                | 126 +++++++++++++++++++++++++++++++++++++
net/socket.c               |  71 +++++++++++++++++++++
net/tap-win32.c            |   9 +++
net/tap.c                  | 103 ++++++++++++++++++++++++++++--
net/vde.c                  |  26 ++++++++
net/vhost-user.c           |  18 +++++-
qapi/net.json              |  85 +++++++++++++++++++++++++
tests/Makefile.include     |   2 +
tests/test-query-netdevs.c | 114 +++++++++++++++++++++++++++++++++
14 files changed, 667 insertions(+), 8 deletions(-)
create mode 100644 tests/test-query-netdevs.c
[PATCH 0/2] Introducing QMP query-netdevs command
Posted by Alexey Kirillov 4 years, 5 months ago
This patch introduces a new QMP command "query-netdevs" to get information
about currently attached network devices.
Potentially, this patch makes the "info_str" field of "struct NetClientState"
and HMP command "info network" obsolete as new command gives out more
information in a structured way.

Usage example:

{ "execute": "x-query-netdevs" }
{ "return": [
    {
      "peer": "netdev0",
      "netdev": "netdev0",
      "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
    }
  ]
}

Alexey Kirillov (2):
  qapi: net: Add query-netdevs command
  tests: Add tests for query-netdevs command

 include/net/net.h          |   1 +
 net/hub.c                  |   8 +++
 net/l2tpv3.c               |  19 ++++++
 net/net.c                  |  80 +++++++++++++++++++++++
 net/netmap.c               |  13 ++++
 net/slirp.c                | 126 +++++++++++++++++++++++++++++++++++++
 net/socket.c               |  71 +++++++++++++++++++++
 net/tap-win32.c            |   9 +++
 net/tap.c                  | 103 ++++++++++++++++++++++++++++--
 net/vde.c                  |  26 ++++++++
 net/vhost-user.c           |  18 +++++-
 qapi/net.json              |  85 +++++++++++++++++++++++++
 tests/Makefile.include     |   2 +
 tests/test-query-netdevs.c | 114 +++++++++++++++++++++++++++++++++
 14 files changed, 667 insertions(+), 8 deletions(-)
 create mode 100644 tests/test-query-netdevs.c

-- 
2.17.1


Re: [PATCH 0/2] Introducing QMP query-netdevs command
Posted by Eric Blake 4 years, 5 months ago
On 11/13/19 3:25 PM, Alexey Kirillov wrote:
> This patch introduces a new QMP command "query-netdevs" to get information
> about currently attached network devices.
> Potentially, this patch makes the "info_str" field of "struct NetClientState"
> and HMP command "info network" obsolete as new command gives out more
> information in a structured way.

Can we rewrite the existing HMP command to call into the new QMP command?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org