Hi Martin,

Thank you so much for your explanation. As you said here:

> Right now we can get domain memory statistics through the following virsh
> cmds:
> 1.      dumpxml: this returns "memory" and "currentMemory"
>

This are settings for the domain that you can change before the domain
starts.  "memory" is the maximum it can reach and "currentMemory" is
what the domain will have it cut down to using a memballoon.

However somehow we can observe RSS greater than the "memory", which is supposed to be the maximum it can reach. Have you ever seen this happen and could you provide us any comment?

Thanks,
Bruce


On Thu, Feb 27, 2014 at 11:16 AM, Martin Kletzander <mkletzan@redhat.com> wrote:
On Tue, Feb 25, 2014 at 09:19:34AM -0500, Qiang Fu wrote:
> Hi all,
>
> I am trying to use virsh to get the memory and storage usage for KVM domain.
>
> Right now we can get domain memory statistics through the following virsh
> cmds:
> 1.      dumpxml: this returns "memory" and "currentMemory"
>

This are settings for the domain that you can change before the domain
starts.  "memory" is the maximum it can reach and "currentMemory" is
what the domain will have it cut down to using a memballoon.

> 2.      dominfo: this returns "Max memory" and "Used memory"
>

This is "memory" and "currentMemory" respectively.

> 3.      dommemstat: this returns "actual" and "rss"
>

"actual" is what qemu reports when we call for stats on monitor, "rss"
is RSS of the qemu process you'd get from /proc, e.g.

# grep VmRSS /proc/$(pidof qemu-system-x86_64)/status
VmRSS:   610508 kB

> We think "memory" (from dumpxml) = "Max memory" (from dominfo) and
> "currentMemory" (from dumpxml) = "Used memory" (from dominfo). Can anyone
> please help us to confirm this?
>

Yes.

> We don't understand what does "actual" stand for in dommemstat. Can anyone
> please explain us about that?
>

As I said above, that's what qemu tells us on the monitor.  I haven't
gone into too much detail when looking at the code, so I can't tell
you many more details, that may be a question for qemu.

> Finally, we want to get the memory utilization of the domain on VM level in
> percentage. And we derive it as:
> Utilization = rss / Used memory
> Can anyone please provide any comment on this?
>
> In terms of disk usage, it seems virsh / libvirt does not support any
> domain disk information right now. If not, can anyone please give us any
> idea how to get the domain disk information (size, used space and so on)?
>

You can get data about volumes in pools (vol-info), about volumes
per-domain (domblkinfo) and their statistics (domblkstat).

Martin

> Thanks a lot,
> Bruce

> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list