On Tue, Apr 14, 2009 at 02:08:27PM -0700, Tyrel Datwyler wrote:
The libvirt API states that the return value of virNodeGetFreeMemory() is
in kilobytes. When making this call against a Xen hypervisor and comparing
the returned value with what is listed by "xm info" it appears that libvirt
is returning the free memory in bytes and not kilobytes. Can anybody
confirm this behavior?
This code snippet:
conn = virConnectOpen("xen:///localhost/");
hostmem = virNodeGetFreeMemory(conn);
fprintf(stdout, "Host free memory = %llu\n", hostmem);
produces the following output:
Host free memory = 3236012032
The following comes from running "xm info" on the Xen host:
free_memory : 3086
The libvirt value is convertable into the "xm" returned value if bytes is
assumed.
Yes that's an unfortunate case where the implementations didn't follow
the expected APIs, all drivers seems to return byte values, instead of
kB. So at this point it sounds better to acknoledge the fact, and avoid
breaking all applications. It's annoying because all other memory APIs
in libvirt use kB so I will put a special not in the function
description.
thanks for the heads-up !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/