[Libvir] Bug in the virDomainGetInfo() API of libvirt 0.1.9 with Xen 3.0.3

Daniel Veillard veillard at redhat.com
Fri Jan 12 14:17:22 UTC 2007


On Fri, Jan 12, 2007 at 03:04:57PM +0100, Philippe Berthault wrote:
> Daniel Veillard a écrit :
> >  I think Xen just returns -1 when the field is uninitialized, probably
> >meaning 'all physical memory'. Once you use "xm mem-max 0 ..." then it
> >consider the Dom0 domain constrained, but not before. And since there
> >are machine where it's possible to hot plug new memory this is a way to
> >not poll the current physical memory, a bit weird but that can be 
> >understood.
> >  
> The signed value -1, "casted" in C/C++ in unsigned integer, gives the 
> value 4294967295. The Max memory value returned by virsh is 4294967292. 
> There is a small difference (3), so the value returned by Xen can't be -1.

  I think it's just a side effect of the conversion from pages number to
kilobytes (assuming you're on a 4k page machine) 

  4294967292 is (((2^32 -1) /4 ) * 4)

xen has -1, but the interface with xen usually count in page tables, and
libvirt just multiplies later to get back to kB, leading to this rounding.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list