[libvirt] KVM Domain memory and disk usage

Martin Kletzander mkletzan at redhat.com
Thu Feb 27 16:16:39 UTC 2014


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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140227/856ffa2f/attachment-0001.sig>


More information about the libvir-list mailing list