Re: virNodeInfo returns MBytes instead of bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30.09.2013 06:34, Sam Giraffe wrote:
> Hi,
> 
> http://www.libvirt.org/html/libvirt-libvirt.html#virNodeInfo says that
> memory size is in kilobytes, however when I use this call I get an
> answer in Megabytes, see below. The hypervisor has 16 GB of RAM.
> 
> $ python
> Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
> [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>> import libvirt
> 
>>>> conn=libvirt.open("qemu+ssh://xx@xxxxxxxxxx/system
> <http://xx@xxxxxxxxxx/system>")
> Enter passphrase for key '/home/xx/.ssh/id_rsa':
> 
>>>> hv_info=conn.getInfo()
> 
>>>> hv_info
> ['x86_64', 15919, 8, 3292, 1, 1, 4, 2]

This is the python bindings bug. From the code:

http://libvirt.org/git/?p=libvirt.git;a=blob;f=python/libvirt-override.c;h=e659bae30ad01b315041e29913fb442c348ed0f6;hb=HEAD#l2846

We are shifting the mem amount left 10 times (effectively divide it by
1024). Hence you'll get MB instead of KB. Although I am not quite sure
how to fix this. I see two options:

1) fix the code (possibly breaking other applications already relying on
the bug)

2) document it as known bug (not consistent with C struct)

Michal

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users




[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux