ia64/xen-unstable

changeset 11585:1db4e40b4d83

[XEND] Check for invalid memory sizes.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author atse@norwich.uk.xensource.com
date Fri Sep 22 15:36:11 2006 +0100 (2006-09-22)
parents a49f9c33aa93
children 332bdaab35fa
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 22 15:06:00 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 22 15:36:11 2006 +0100
     1.3 @@ -596,6 +596,8 @@ class XendDomainInfo:
     1.4              if self.info['memory'] == 0:
     1.5                  if self.infoIsSet('mem_kb'):
     1.6                      self.info['memory'] = (self.info['mem_kb'] + 1023) / 1024
     1.7 +            if self.info['memory'] <= 0:
     1.8 +                raise VmError('Invalid memory size')
     1.9  
    1.10              if self.info['maxmem'] < self.info['memory']:
    1.11                  self.info['maxmem'] = self.info['memory']
    1.12 @@ -1001,6 +1003,9 @@ class XendDomainInfo:
    1.13          """Set the memory target of this domain.
    1.14          @param target In MiB.
    1.15          """
    1.16 +        if target <= 0:
    1.17 +            raise XendError('Invalid memory size')
    1.18 +        
    1.19          log.debug("Setting memory target of domain %s (%d) to %d MiB.",
    1.20                    self.info['name'], self.domid, target)
    1.21