ia64/xen-unstable

changeset 14464:066b66ce1f98

Fix memory size handling.

These were by Tom Wilkie <tom.wilkie@gmail.com>, and were dropped accidentally
by me when merging.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Mar 19 11:09:57 2007 +0000 (2007-03-19)
parents f40079acf646
children 4b9150e9ecfd
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 19 09:34:42 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 19 11:09:57 2007 +0000
     1.3 @@ -576,12 +576,14 @@ class XendDomainInfo:
     1.4          if target <= 0:
     1.5              raise XendError('Invalid memory size')
     1.6          
     1.7 -        self.info['memory_static_min'] = target * 1024 * 1024
     1.8 +        MiB = 1024 * 1024
     1.9 +        self.info['memory_dynamic_min'] = target * MiB
    1.10 +        self.info['memory_dynamic_max'] = target * MiB
    1.11 +
    1.12          if self.domid >= 0:
    1.13              self.storeVm("memory", target)
    1.14              self.storeDom("memory/target", target << 10)
    1.15          else:
    1.16 -            self.info['memory_dynamic_min'] = target
    1.17              xen.xend.XendDomain.instance().managed_config_save(self)
    1.18  
    1.19      def setMemoryMaximum(self, limit):
    1.20 @@ -981,7 +983,7 @@ class XendDomainInfo:
    1.21  
    1.22      def getMemoryTarget(self):
    1.23          """Get this domain's target memory size, in KB."""
    1.24 -        return self.info['memory_static_min'] / 1024
    1.25 +        return self.info['memory_dynamic_max'] / 1024
    1.26  
    1.27      def getMemoryMaximum(self):
    1.28          """Get this domain's maximum memory size, in KB."""
    1.29 @@ -1470,7 +1472,7 @@ class XendDomainInfo:
    1.30              # values. maxmem, memory, and shadow are all in KiB.
    1.31              # but memory_static_max etc are all stored in bytes now.
    1.32              memory = self.image.getRequiredAvailableMemory(
    1.33 -                self.info['memory_static_min'] / 1024)
    1.34 +                self.info['memory_dynamic_max'] / 1024)
    1.35              maxmem = self.image.getRequiredAvailableMemory(
    1.36                  self.info['memory_static_max'] / 1024)
    1.37              shadow = self.image.getRequiredShadowMemory(
    1.38 @@ -2018,7 +2020,11 @@ class XendDomainInfo:
    1.39              info = dom_get(self.domid)
    1.40              if not info:
    1.41                  return
    1.42 -            
    1.43 +
    1.44 +        if info["maxmem_kb"] < 0:
    1.45 +            info["maxmem_kb"] = XendNode.instance() \
    1.46 +                                .physinfo_dict()['total_memory'] * 1024
    1.47 +
    1.48          #manually update ssidref / security fields
    1.49          if security.on() and info.has_key('ssidref'):
    1.50              if (info['ssidref'] != 0) and self.info.has_key('security'):
    1.51 @@ -2402,7 +2408,7 @@ class XendDomainInfo:
    1.52      def __str__(self):
    1.53          return '<domain id=%s name=%s memory=%s state=%s>' % \
    1.54                 (str(self.domid), self.info['name_label'],
    1.55 -                str(self.info['memory_static_min']), DOM_STATES[self.state])
    1.56 +                str(self.info['memory_dynamic_max']), DOM_STATES[self.state])
    1.57  
    1.58      __repr__ = __str__
    1.59