Created attachment 340916 [details] python script for getting node info Description of problem: Invoking virNodeGetInfo() to get the memory size, actually the return value is megabytes, not kilobytes. Version-Release number of selected component (if applicable): rhel5u3: 2.6.18-128.el5 kvm-83-27.el5ovirt libvirt-0.6.2-1.el5 How reproducible: Always Steps to Reproduce: 1. run the python script conn_getinfo.py to get memory info 2. # virsh nodeinfo 3. compare the results of memory size Actual results: ------ conn_getinfo.py ------ Memory size: 3892 kB ------ virsh nodeinfo ------ Memory size: 3985548 kB Expected results: Should be return kilobytes for memory size. Additional info: On libvirt.org, the api reference indicate the memory value should be return kilobytes.
The python bindings have been returned megabyte informations forever python/libvir.c::libvirt_virNodeGetInfo() does PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.memory >> 10)); src/virsh.c::cmdNodeinfo() does vshPrint(ctl, "%-20s %lu kB\n", _("Memory size:"), info.memory); This is an inconsistency of the python bindings in my opinion, but a priori not bug, though it's annoying, I think trying to change this now would generate more breakage than help, for example virt-manager which is using the python bindings gets the values right. Daniel