Thanks for the review and comments on V1. This series tries to address most of
the feedback I received. I did not add any additional memory stats yet (I feel
that with my new method of expanding the API, that can be handled separately).
I am not convinced that every memory stat that any hypervisor exports should
necessarily be included in this API. I tried to focus on statistics that are
useful in the context of managing domains at the hypervisor level.
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] domMemStats: 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