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.
Regards,
Tyrel Datwyler
Linux Software Engineer
eServer Systems Management
IBM Systems and Technology Group
Email: tyreld@us.ibm.com
External: (503) 578-3489, T/L: 775-3489