[libvirt] virNodeGetFreeMemory() returns bytes with Xen driver

Tyrel Datwyler tyreld at us.ibm.com
Tue Apr 14 21:08:27 UTC 2009



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 at us.ibm.com
External: (503) 578-3489,  T/L: 775-3489
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090414/8312e631/attachment-0001.htm>


More information about the libvir-list mailing list