[Libvir] [PATCH] setmem checks

Daniel Veillard veillard at redhat.com
Fri Jun 15 09:09:37 UTC 2007


On Fri, Jun 15, 2007 at 08:59:50AM +0100, Richard W.M. Jones wrote:
> Mark Johnson wrote:
> >1673a1675,1677
> >>    if (virDomainGetInfo(dom, &info) != 0) {
> >>      info.maxMem = 0;
> >>    }
> >1675c1679
> ><     if (kilobytes <= 0) {
> >---
> >>    if ((kilobytes <= 0)  || (kilobytes > info.maxMem)) {
> 
> I don't understand this bit.  If virDomainGetInfo fails then it'll 
> always give an error because kilobytes > info.maxMem (== 0) ?

  Agreed, we probably need to better handle the case where virDomainGetInfo
fails, there was an actual scenario where we still wanted to try to set the
memory anyway, but I can't remember. But the idea of the patch is fine...
  I'm not too fond of
    info.memory = 0x7fffffff;
can we express that value like (((unsigned int) 1 << 31) -1 ) or a standard
macro value for MAX_INT ? but that's cosmetic.

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