Bug 681973

Summary: virsh domifstat results do not match that of netstat -i
Product: Red Hat Enterprise Linux 5 Reporter: John Tavares <john_tavares>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.5CC: berrange, crobinso, eblake, virt-maint, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-04 10:42:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John Tavares 2011-03-03 18:27:29 UTC
Description of problem:
It appears as thought virsh domifstat is reporting all the rx_* metrics using the results the corresponding tx_* values and vice versa.

Version-Release number of selected component (if applicable):
I found this on RHEL 5.5

# cat /etc/*-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

# virsh version
Compiled against library: libvir 0.6.3
Using library: libvir 0.6.3
Using API: QEMU 0.6.3
Running hypervisor: QEMU 0.9.1

and every other previous version I have tried.

How reproducible:
Compare the results of netstat -i to that the virsh domifstat on any Xen/KVM Dom0 and compare the results

Steps to Reproduce:
1.Log onto Xen/Dom0
2.Run netstat -i
3.Run virsh domifstat on any virtual network
4.Compare results
  
Actual results:
# netstat -i | grep vnet10
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
vnet10     1500   0  6290598      0      0      0 402479772      0      0     24 BMRU

# virsh domifstat 10 vnet10
vnet10 rx_bytes 26160407282
vnet10 rx_packets 402478167
vnet10 rx_errs 0
vnet10 rx_drop 0
vnet10 tx_bytes 1513645419
vnet10 tx_packets 6290561
vnet10 tx_errs 0
vnet10 tx_drop 0


Expected results:
# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
vnet10     1500   0  6290598      0      0      0 402479772      0      0     24 BMRU

# virsh domifstat 10 vnet10
vnet10 rx_bytes 1513645419 
vnet10 rx_packets 6290561 
vnet10 rx_errs 0
vnet10 rx_drop 0
vnet10 tx_bytes 26160407282
vnet10 tx_packets 402478167
vnet10 tx_errs 0
vnet10 tx_drop 0

Additional info:
I have been able to reproduce this on all previous versions of virsh I could find.

Comment 1 Daniel Berrangé 2011-03-04 10:42:27 UTC
libvirt *is* actually reporting correctly here.  The 'vnet0' device seen in the host OS, is the backend of the 'eth0' device seen in the guest. Anything that the vnet0 reports as 'tx' is seen by the guest eth0 as 'rx', and vica-verca.  libvirt reports the stats from the guest eth0 POV, not the vnet0 POV.