Bug 497297

Summary: libvirt: the memory return value of the struct virNodeInfo is not matching with the xml description
Product: Red Hat Enterprise Linux 5 Reporter: Nan Zhang <nzhang>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: virt-maint, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-23 13:15:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
python script for getting node info none

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