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@xx.xxx.com/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]
15,919 is the number I am referencing, should that not be in bytes and not
MB?
God knows why this was done, but the python binding was written to convert
the KB value from the C API into MB :-(
PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.memory >> 10));
For backwards compat reasons, we cannot change that default behaviour:-)
We could I guess add a flag to let you request sane behaviour though
eg something like
conn.getInfo(memkb=True)
Daniel
--
|: