[libvirt] New libvirt API for domain memory statistics reporting (V4)

Daniel Veillard veillard at redhat.com
Sun Dec 20 12:54:33 UTC 2009

On Fri, Dec 18, 2009 at 01:17:03PM -0500, Adam Litke wrote:
> Daniel, this should be ready for you to merge...

  Okidoc, done !
There was a bit of tweaking since this conflicted with another new API,
but this was eay to solve. I double checked the new
src/remote/remote_protocol.x description and that looks fine,
I think the only thing missing is a description of the new virsh command
in tools/virsh.pod and I think this will be complete. Ah and other
bindings need to be updated to export the new function, but that's

  thanks !


> Changes since V3:
>  * Fixed remote_protocol.x so rpcgen generates the right code
>  * Updated stat constants and names in python api
>  * Incorporate flags into the rpc wire format
> Changes since V2:
>  * Ported to GIT HEAD for easier merging :)
>  * Amounts of memory are now reported in kilobytes
>  * Added flags parameter to API (currently unused)
>  * Moved to less awkward xdr wire format for remote driver
>  * Stats 'Free' and 'Total' renamed to 'Unused' and 'Available'
>  * Various small fixups: constant names, data types, etc
> Changes since V1:
> * New system for maintaining ABI compatibility and API extensibility:
>     Rather than passing around a fixed-size stats structure, work with arrays
>     of stats.  An enum of known statistic tags (SWAP_IN, SWAP_OUT, TOTAL_MEM,
>     etc) is defined.  A stat is defined as a tag/value pair.  When making a
>     call to the API, the caller provides an array of stats and the size of the
>     array.  That array is filled with up to the requested number of stats
>     (depending on hypervisor and guest support).  The number of stats provided
>     is returned.
> * Miscellaneous changes:
>     Changed the API function from virDomainMemStats to virDomainMemoryStats
>     Added documentation for each memory stat
> --
> When using ballooning to manage overcommitted memory on a host, a system for
> guests to communicate their memory usage to the host can provide information
> that will minimize the impact of ballooning on the guests while maximizing
> efficient use of host memory.
> The design of such a communication channel was recently added to version 0.8.2
> of the VirtIO Spec (See Appendix G):
>  - http://ozlabs.org/~rusty/virtio-spec/virtio-spec-0.8.2.pdf
> Host-side and guest-side implementations have been accepted for inclusion in
> their respective projects:
>  - Guest: http://lkml.org/lkml/2009/11/30/274
>  - Host: http://lists.gnu.org/archive/html/qemu-devel/2009-12/msg00380.html
> The following patch series implements a new libvirt interface to expose these
> memory statistics.  Thank you for your review and comments.
> [PATCH 1/6] domMemoryStats: Add domainMemoryStats method to struct _virDriver
> [PATCH 2/6] domMemoryStats: Add public symbol to libvirt API
> [PATCH 3/6] qemu-driver: Enable domainMemStats in the qemu driver
> [PATCH 4/6] remote-driver: Add domainMemoryStats support
> [PATCH 5/6] virsh: Enable virDomainMemoryStats as a new command
> [PATCH 6/6] python: Add python bindings for virDomainMemoryStats

Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

More information about the libvir-list mailing list