[Libvir] [PATCH 0/2] KVM network stats

This two part patch collects network interface stats from KVM domains. With this patch, virt-top will show the stats in its network interface view, as in the screengrab below. Rich. virt-top 15:47:38 - x86_64 4/4CPU 2814MHz 3967MB 0.1% 1 domains, 1 active, 1 running, 0 sleeping, 0 paused, 0 inactive D:0 O:0 X:0 CPU: 3.0% Mem: 250 MB (250 MB by guests) ID S RXBY TXBY RXPK TXPK DOMAIN INTERFACE 1 R 222K 5436 175 78 debian32kvm vnet0 -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Firstly there's a bug in how we parse /proc/net/dev. The format of each interface line turns out to be: %6s:... so in other words network interface names smaller than 6 characters are right justified (padded on the left with spaces). This isn't a problem for Xen because the shortest interface name (eg. 'vif1.0') is always 6 or more characters long. However it is a problem for QEMU and KVM because we have interface names such as 'vnet0'. In any case, the following patch fixes this bug. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

On Thu, Nov 15, 2007 at 03:53:00PM +0000, Richard W.M. Jones wrote:
Firstly there's a bug in how we parse /proc/net/dev. The format of each interface line turns out to be:
%6s:...
so in other words network interface names smaller than 6 characters are right justified (padded on the left with spaces).
This isn't a problem for Xen because the shortest interface name (eg. 'vif1.0') is always 6 or more characters long. However it is a problem for QEMU and KVM because we have interface names such as 'vnet0'.
In any case, the following patch fixes this bug.
Looks fine to me, bugfix, +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel Veillard wrote:
On Thu, Nov 15, 2007 at 03:53:00PM +0000, Richard W.M. Jones wrote:
Firstly there's a bug in how we parse /proc/net/dev. The format of each interface line turns out to be:
%6s:...
so in other words network interface names smaller than 6 characters are right justified (padded on the left with spaces).
This isn't a problem for Xen because the shortest interface name (eg. 'vif1.0') is always 6 or more characters long. However it is a problem for QEMU and KVM because we have interface names such as 'vnet0'.
In any case, the following patch fixes this bug.
Looks fine to me, bugfix, +1
Thanks, both patches applied. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

This patch adds the implementation of virDomainInterfaceStats for QEMU & KVM domains. The function simply verifies that the requested path (interface name) belongs to the domain, then calls the existing code in stats_linux.c. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

On Thu, Nov 15, 2007 at 03:53:03PM +0000, Richard W.M. Jones wrote:
This patch adds the implementation of virDomainInterfaceStats for QEMU & KVM domains. The function simply verifies that the requested path (interface name) belongs to the domain, then calls the existing code in stats_linux.c.
Okay since it's just filtering around the existing Linux extraction routine it's rather simple, looks fine to me, +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel Veillard
-
Richard W.M. Jones