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.
Thanks
Kumar