Re: Need help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 21, 2022 at 08:14:14PM +0530, Gk Gk wrote:
> Hi All,
> 
> I am trying to get guest VM's disk statistics using a libvirt python
> library as follows:
> ---
> raw_xml = domain.XMLDesc(0)
> for disk in doc.getElementsByTagName('disk'):
>   disk_data = disk.getElementsByTagName('target')
> ---
> 
> The above code is yielding the following stats for two disks inside the VM:
> --
> disk_name=sda
> read_req=34137,read_bytes=445358592,write_req=2405970,write_bytes=24943391744
> disk_name=sdb
> read_req=34357,read_bytes=450754048,write_req=2405984,write_bytes=24943465472
> ---
> 
> The write_bytes divided by 1024 yields 24358853 kB.
> But when I compare the above statistics from the iostat data shown from
> inside the VM, I see a stark difference between the two results as shown
> below:
> 
> ---
> root@sample:~# iostat
> Linux 4.15.0-101-generic (sample) 12/21/2022 _x86_64_ (1 CPU)
> 
> avg-cpu:  %user   %nice %system %iowait  %steal   %idle
>            0.27    0.00    0.03    0.02    0.01   99.68
> 
> Device             tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sda               0.24         0.04        11.87     400052  121844120
> sdb               0.00         0.00         1.19       5269   12223752
> ----
> 
> Why is there a huge difference in the number of bytes read and written for
> the two disks as reported by libvirt ?  Please explain.

Note that libvirt reports data that starts from when the virtual
machine was created.

The guest OS reports data that starts from when the kernel
booted.

IOW, if you have a running guest, and reboot it several times,
the guest OS values will keep getting reset back to 0 on each
boot, but the libvirt values will accumulate, until a hard
poweroff.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux