Bug 497297 - libvirt: the memory return value of the struct virNodeInfo is not matching with the xml description
libvirt: the memory return value of the struct virNodeInfo is not matching wi...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2009-04-23 05:27 EDT by Nan Zhang
Modified: 2009-12-14 16:23 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-04-23 09:15:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
python script for getting node info (4.09 KB, text/plain)
2009-04-23 05:27 EDT, Nan Zhang
no flags Details

  None (edit)
Description Nan Zhang 2009-04-23 05:27:13 EDT
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

How reproducible:

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.
Comment 1 Daniel Veillard 2009-04-23 09:15:39 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.