On 02/03/2012 07:53 AM, Martin Kletzander wrote:
> Two types of memory stats were not reported by python bindings. This
> patch fixes both of them.
> ---
> python/libvirt-override.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/python/libvirt-override.c b/python/libvirt-override.c
> index 18849f8..289a9bb 100644
> --- a/python/libvirt-override.c
> +++ b/python/libvirt-override.c
> @@ -258,6 +258,12 @@ libvirt_virDomainMemoryStats(PyObject *self
> ATTRIBUTE_UNUSED, PyObject *args) {
> else if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_AVAILABLE)
> PyDict_SetItem(info, libvirt_constcharPtrWrap("available"),
> PyLong_FromUnsignedLongLong(stats[i].val));
> + else if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
> + PyDict_SetItem(info, libvirt_constcharPtrWrap("actual"),
> + PyLong_FromUnsignedLongLong(stats[i].val));
> + else if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_RSS)
> + PyDict_SetItem(info, libvirt_constcharPtrWrap("rss"),
> + PyLong_FromUnsignedLongLong(stats[i].val));ACK and pushed. Note that you are perpetuating two already-existing bugs in this function: - libvirt_constcharPtrWrap() can fail on OOM and return NULL, but PyDict_SetItem() is not tolerant of NULL - PyDict_SetItem() can fail and set a python exception (typically on OOM), but we are silently ignoring that but that's just part of my general complaint that we need to scrub this entire file, and not worth holding up your patch while waiting for the overall cleanups. -- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
