[libvirt] [PATCH 6/7] qemu: stats: Display the net type and net source in bulk stats

Lin Ma posted 7 patches 7 years ago
[libvirt] [PATCH 6/7] qemu: stats: Display the net type and net source in bulk stats
Posted by Lin Ma 7 years ago
Signed-off-by: Lin Ma <lma@suse.com>
---
 src/libvirt-domain.c   | 2 ++
 src/qemu/qemu_driver.c | 4 ++++
 tools/virsh.pod        | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 2d86e48979..e317ca00d0 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11310,6 +11310,8 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
  *     "net.count" - number of network interfaces on this domain
  *                   as unsigned int.
  *     "net.<num>.name" - name of the interface <num> as string.
+ *     "net.<num>.type" - type of the interface <num> as string.
+ *     "net.<num>.source" - source of the interface <num> as string.
  *     "net.<num>.rx.bytes" - bytes received as unsigned long long.
  *     "net.<num>.rx.pkts" - packets received as unsigned long long.
  *     "net.<num>.rx.errs" - receive errors as unsigned long long.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 83fc191085..7a9a2bcf97 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19823,6 +19823,10 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
         QEMU_ADD_NAME_PARAM(record, maxparams,
                             "net", "name", i, net->ifname);
+        QEMU_ADD_NAME_PARAM(record, maxparams,
+                            "net", "type", i, virDomainNetTypeToString(net->type));
+        QEMU_ADD_NAME_PARAM(record, maxparams,
+                            "net", "source", i, net->data.bridge.brname);
 
         if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
             if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 929958a953..7ec57c0b4b 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -974,6 +974,8 @@ I<--interface> returns:
 
  "net.count" - number of network interfaces on this domain
  "net.<num>.name" - name of the interface <num>
+ "net.<num>.type" - type of the interface <num>
+ "net.<num>.source" - source of the interface <num>
  "net.<num>.rx.bytes" - number of bytes received
  "net.<num>.rx.pkts" - number of packets received
  "net.<num>.rx.errs" - number of receive errors
-- 
2.15.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] qemu: stats: Display the net type and net source in bulk stats
Posted by Peter Krempa 7 years ago
On Fri, May 04, 2018 at 17:28:53 +0800, Lin Ma wrote:
> Signed-off-by: Lin Ma <lma@suse.com>
> ---

Could you justify this? This is really configuration and will not change
during the lifetime of the interface, thus there's no pressing need to
report it in the stats which should report only data which is changing.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] qemu: stats: Display the net type and net source in bulk stats
Posted by Lin Ma 7 years ago

On 05/04/2018 06:10 PM, Peter Krempa wrote:
> On Fri, May 04, 2018 at 17:28:53 +0800, Lin Ma wrote:
>> Signed-off-by: Lin Ma <lma@suse.com>
>> ---
> Could you justify this? This is really configuration and will not change
> during the lifetime of the interface, thus there's no pressing need to
> report it in the stats which should report only data which is changing.
>
well, Actually there is nothing special usecase, Just want to provide 
more corresponding
information in a single command to users, Please forget it if it doesn't 
make sense.

Thanks,
Lin
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list