Just to clarify my problems:
For each KVM virtual machine, it is actually a process running on the host.
The $pid in "/proc/$pid/io" represents the VM process’s PID. All my work
is done on the host, not inside the VMs. Take the VM process’s pid is “pid”,
What the /proc/$pid/io records is io statistics of the VM from the host’s
perspective. I understand that qemu might do some I/O coalescing kind of
work, but /proc/$pid/io reveals the actual IOs submitted to the host kernel.
For example, through “ps” command, i get the following info of one of my
VMs: (the pid of the VM process is 4438)
qemu 4438 1 0 Jun24 ? 00:06:25 /usr/bin/qemu-system-x86_64 ...
[unrelevant data fields are ignored]
Command line "virsh domblkstat $vmname vda” get the results below:
vda rd_bytes 639415808
vda wr_bytes 728186880
Command line "cat /proc/4438/io” get the result below:
read_bytes: 772415488
write_bytes: 734040064
I execute the above two commands consecutively using “&&", but we can
that the results vary a lot, especially for the read_bytes.
Since libvirt virDomainBlockStats API reads data from qemu i should ask
the qemu folks for the answers. Great thanks, anyway.
On Jun 25, 2014, at 3:45 AM, Eric Blake <eblake(a)redhat.com> wrote:
On 06/24/2014 02:24 AM, coperd wrote:
>
> It is supposed that the VM’s disk “rd_bytes" and “wr_bytes" should
never exceed the value of the physical disk respectively, right ?
That's a question for the qemu folks.
> Doesn’t
> libvirt virDomainBlockStats read disk information from “proc” ?
No, libvirt reads it from the qemu QMP command query-blockstats. Beyond
that, you'll have to investigate how qemu comes up with that number.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org