Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 597690 - Not showing disk and network stats
Not showing disk and network stats
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: virt-top (Show other bugs)
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
: 487533 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2010-05-30 00:56 EDT by Neil Aggarwal
Modified: 2011-10-16 15:05 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Log with libvirt debugging (23.40 KB, text/plain)
2010-06-01 09:47 EDT, Neil Aggarwal
no flags Details
Patch to compile ocaml-libvirt with -Wno-deprecated-declarations (557 bytes, patch)
2010-10-26 15:17 EDT, Ben Slusky
no flags Details | Diff

  None (edit)
Description Neil Aggarwal 2010-05-30 00:56:06 EDT
Description of problem:
I have a CentOS server.  It was originally installed with CentOS 5.4 and I did a yum update when CentOS 5.5 came out.
When I run virt-top, the disk and network stats columns are empty.
According to Richard Jones, the stats should be there if the virsh domain stat commands work correctly.  They seem to be working fine on my system.

When I run this command:
virsh domblkstat v1059 hda

I get this output:
hda rd_req 24855
hda rd_bytes 374052352
hda wr_req 413829
hda wr_bytes 4122740736

When I run this command:
virsh domifstat v1059 v1059

I get this output:
v1059 rx_bytes 142375408
v1059 rx_packets 1780860
v1059 rx_errs 0
v1059 rx_drop 0
v1059 tx_bytes 43514726
v1059 tx_packets 340412
v1059 tx_errs 0
v1059 tx_drop 0

I tried to generate a debug log by running this command:
virt-top --debug virt-top.log

When I do that, virt-top runs normally.
After exiting virt-top, the debug file is empty.  It is created
by the program so it is doing something. 

Version-Release number of selected component:
libvirt 0.6.3
kvm 83-164.el5

How reproducible:
This always happens on my system.

Steps to Reproduce:
1. Add EPEL repo
2. Install virt-top
3. Run virt-top
Actual results:

The virt-top screen looks like this:

virt-top 23:54:05 - x86_64 6/6CPU 2211MHz 7990MB 1.8%
9 domains, 9 active, 9 running, 0 sleeping, 0 paused, 0 inactive D:0 O:0 X:0
CPU: 2.3%  Mem: 9216 MB (9216 MB by guests)

   11 R                      1.4  6.0 117:29.25 v1158
    3 R                      0.7 25.0 297:10.49 nickVPS
    4 R                      0.2  6.0 201:54.18 v1154
    8 R                      0.1 25.0 381:31.97 v1059
    9 R                      0.0 25.0 384:11.68 v1060
    1 R                      0.0  6.0 175:53.02 v1062
    7 R                      0.0  6.0  59:21.77 v1103
    2 R                      0.0  6.0  21:20.85 v1157
   14 R                      0.0  6.0  58:49.60 v1159

Expected results:
The disk and network stats columns should be filled in.
Comment 1 Richard W.M. Jones 2010-06-01 06:23:24 EDT
(In reply to comment #0)
> I tried to generate a debug log by running this command:
> virt-top --debug virt-top.log
> When I do that, virt-top runs normally.
> After exiting virt-top, the debug file is empty.  It is created
> by the program so it is doing something. 

That's good, because it means nothing is writing errors to stderr
which are being lost.

However for this I'd also like to see libvirt debugging, so can
you do:

virt-top --debug virt-top.log

and append the log file here.
Comment 2 Neil Aggarwal 2010-06-01 09:47:40 EDT
Created attachment 418641 [details]
Log with libvirt debugging
Comment 3 Wolfram Schlich (LVM) 2010-09-08 13:13:00 EDT
Same here, RDRQ WRRQ RXBY TXBY empty with 1.0.4 (not empty with
Comment 4 Richard W.M. Jones 2010-09-08 13:16:01 EDT
What's the output of virsh *stat commands, and virt-top --debug?  (see
comment 0 and comment 1).
Comment 5 Julio Entrena Perez 2010-10-04 12:43:18 EDT
Same problem here.

[root@r210xen ~]# virsh dumpxml rhel55pv
<domain type='xen' id='3'>
    <cmdline>ro root=/dev/VolGroup00/LogVol00</cmdline>
  <clock offset='utc'/>
    <disk type='block' device='disk'>
      <driver name='phy'/>
      <source dev='/dev/VolGroup01/rhel55pv'/>
      <target dev='xvda' bus='xen'/>
    <interface type='bridge'>
      <mac address='00:16:36:65:e2:2f'/>
      <source bridge='xenbr0'/>
      <script path='vif-bridge'/>
      <target dev='vif3.0'/>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
    <input type='mouse' bus='xen'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='en-gb'/>

[root@r210xen ~]# virsh domifstat rhel55pv vif3.0
vif3.0 rx_bytes 21124047
vif3.0 rx_packets 45256
vif3.0 rx_errs 0
vif3.0 rx_drop 3703
vif3.0 tx_bytes 482084
vif3.0 tx_packets 1884
vif3.0 tx_errs 0
vif3.0 tx_drop 0

[root@r210xen ~]# virsh domblkstat rhel55pv xvda
xvda rd_req 13822
xvda rd_bytes 229754368
xvda wr_req 7523
xvda wr_bytes 64865280
xvda errs 0

virt-top --debug creates an empty debug file.

I've setup a reproducer, please contact me if you need to access it.
Comment 6 Richard W.M. Jones 2010-10-04 12:46:42 EDT
Julio, do the stats change over time, eg. if you run the domifstat
command, wait a minute, then run it again?
Comment 7 Julio Entrena Perez 2010-10-04 12:51:15 EDT
Yes, they do:

[root@r210xen ~]# virsh domifstat rhel55pv vif3.0
vif3.0 rx_bytes 25297484
vif3.0 rx_packets 49236
vif3.0 rx_errs 0
vif3.0 rx_drop 3703
vif3.0 tx_bytes 557224
vif3.0 tx_packets 3055
vif3.0 tx_errs 0
vif3.0 tx_drop 0

[root@r210xen ~]# virsh domblkstat rhel55pv xvda
xvda rd_req 19453
xvda rd_bytes 259163648
xvda wr_req 42542
xvda wr_bytes 227656704
xvda errs 0
Comment 8 Richard W.M. Jones 2010-10-04 13:16:06 EDT
OK I have a theory about why this is happening now.

If you have EPEL 5, you could try this test ...

# yum install ocaml ocaml-findlib-devel ocaml-libvirt-devel

Copy the following into a file, change the guest and device
if necessary, and make sure the file is chmod +x (executable):

#!/usr/bin/ocamlrun /usr/bin/ocaml
#use "topfind";;
#require "libvirt";;
let guest = "rhel55pv"
let device = "xvda"
open Printf
let conn = Libvirt.Connect.connect_readonly ()
module D = Libvirt.Domain
let dom = D.lookup_by_name conn guest
let { D.rd_req = rd_req; rd_bytes = rd_bytes;
      wr_req = wr_req; wr_bytes = wr_bytes } = D.block_stats dom device
let () =
  printf "rd_req = %Ld  rd_bytes = %Ld\n" rd_req rd_bytes;
  printf "wr_req = %Ld  wr_bytes = %Ld\n" wr_req wr_bytes

sudo /tmp/test.ml

For me, on Fedora, this prints stats, eg:

rd_req = 120013  rd_bytes = 4103219200
wr_req = 37548  wr_bytes = 5163249664

but on RHEL 5 this prints an error:

Exception: Libvirt.Not_supported "virDomainBlockStats".

The good news is that if you can reproduce the same error,
then it's very easy to fix -- just need a simple recompile
against the updated libvirt.
Comment 9 Julio Entrena Perez 2010-10-05 05:10:29 EDT
Richard, I can reproduce the same error:

[root@r210xen ~]# /tmp/test.ml 
Exception: Libvirt.Not_supported "virDomainBlockStats".
Comment 10 Julio Entrena Perez 2010-10-26 09:16:07 EDT
Richard, this BZ seems to be a duplicate of bz#487533.
Comment 11 Richard W.M. Jones 2010-10-26 10:02:00 EDT
*** Bug 487533 has been marked as a duplicate of this bug. ***
Comment 12 Richard W.M. Jones 2010-10-26 10:02:45 EDT
I agree.  BTW someone with some spare time can just go ahead
and fix this by rebuilding ocaml-libvirt and virt-top packages.
Comment 13 Ben Slusky 2010-10-26 15:13:06 EDT
I can confirm that this works, except that ocaml-libvirt- uses bits of libvirt that are deprecated in recent releases, and so can't be compiled with -Wall -Werror. Adding -Wno-deprecated-declarations fixes this.
Comment 14 Ben Slusky 2010-10-26 15:17:45 EDT
Created attachment 455851 [details]
Patch to compile ocaml-libvirt with -Wno-deprecated-declarations

Note You need to log in before you can comment on or make changes to this bug.