[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Libvir] Bug in the virDomainGetInfo() API of libvirt 0.1.9 with Xen 3.0.3
- From: "Daniel P. Berrange" <berrange redhat com>
- To: Philippe Berthault <Philippe Berthault Bull net>
- Cc: LibVir <libvir-list redhat com>
- Subject: Re: [Libvir] Bug in the virDomainGetInfo() API of libvirt 0.1.9 with Xen 3.0.3
- Date: Fri, 12 Jan 2007 14:24:12 +0000
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.
You're forgetting though, that xen measures this in terms of pages. Libvirt
converts that to bytes. The virsh converts it to KB when printing it.
$cat > demo.c <<EOF
#include <stdio.h>
int main() {
unsigned int max_pages = ~0U;
unsigned long long mem = (unsigned long long)max_pages * 4096ull;
unsigned long memkb = mem / 1024;
printf("%u %llu %lu\n",
max_pages,
mem,
memkb);
}
EOF
$ gcc -o demo demo.c
$ ./demo
4294967295 17592186040320 4294967292
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]