Bug 497297 - libvirt: the memory return value of the struct virNodeInfo is not matching with the xml description
Summary: libvirt: the memory return value of the struct virNodeInfo is not matching wi...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-23 09:27 UTC by Nan Zhang
Modified: 2009-12-14 21:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-04-23 13:15:39 UTC
Target Upstream Version:
Embargoed:


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

Description Nan Zhang 2009-04-23 09:27:13 UTC
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.

Comment 1 Daniel Veillard 2009-04-23 13:15:39 UTC
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


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