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

Adam Litke agl at us.ibm.com
Thu Dec 17 22:41:41 UTC 2009


Daniel, Daniel, and Matthias: Thanks for your review.  This series addresses
almost all of your most recent comments.  I am still working on writing a
decent implementation for the test driver but I wanted to get these updates out
right away.

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




More information about the libvir-list mailing list