virNodeGetFreeMemory() returns bytes with Xen driver

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

Hi Tyrel, My guess is that the libvirt documentation is incorrect. I would follow up with the libvirt devs on libvir-list@redhat.com to be sure though. 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.
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
------------------------------------------------------------------------
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

On Tue, Apr 14, 2009 at 08:12:10AM -0700, Kaitlin Rupert wrote:
Hi Tyrel,
My guess is that the libvirt documentation is incorrect. I would follow up with the libvirt devs on libvir-list@redhat.com to be sure though.
Yes, that's unfortunate, as I replied on the list the implementations didn't follow the description, so I'm updating the description with a note to avoid troubles. Daniel
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.
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
------------------------------------------------------------------------
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel Veillard
-
Kaitlin Rupert
-
Tyrel Datwyler