ia64/xen-unstable

changeset 12329:33ae8ae8693c

[XEND][XM] Move system memory reporting to XendConfig rather than getSysMem.

Remove the additional XMLRPC calls per domain just to get system
memory and instead make sure we update that value and return it via
the SXP that gets returned when xm list is called.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Thu Nov 09 12:36:20 2006 +0000 (2006-11-09)
parents b8a2db59150a
children 023aa2926e79
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/XMLRPCServer.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Wed Nov 08 18:29:16 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Nov 09 12:36:20 2006 +0000
     1.3 @@ -661,6 +661,8 @@ class XendConfig(dict):
     1.4              sxpr.append(['status', str(DOM_STATE_HALTED)])
     1.5  
     1.6          sxpr.append(['state', self._get_old_state_string()])
     1.7 +        sxpr.append(['memory_dynamic_max', self.get('memory_dynamic_max',
     1.8 +                                                    self['memory'])])
     1.9  
    1.10          # For save/restore migration
    1.11          if domain:
    1.12 @@ -718,6 +720,10 @@ class XendConfig(dict):
    1.13  
    1.14          self['maxmem'] = max(self['memory'], self['maxmem'])
    1.15  
    1.16 +        # convert mem_kb from domain_getinfo to something more descriptive
    1.17 +        if 'mem_kb' in self:
    1.18 +            self['memory_dynamic_max'] = (self['mem_kb'] + 1023)/1024
    1.19 +
    1.20          # Verify devices
    1.21          for d_uuid, (d_type, d_info) in self['device'].items():
    1.22              if d_type not in XendDevices.valid_devices():
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Nov 08 18:29:16 2006 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Nov 09 12:36:20 2006 +0000
     2.3 @@ -1044,11 +1044,6 @@ class XendDomainInfo:
     2.4          except:
     2.5              log.exception('Failed to restart domain %s.', str(old_domid))
     2.6  
     2.7 -    def getSysMem(self):
     2.8 -        info = dom_get(self.domid)
     2.9 -        xs_memory=int(info['mem_kb'])/1024
    2.10 -        return xs_memory
    2.11 -
    2.12      def _preserveForRestart(self):
    2.13          """Preserve a domain that has been shut down, by giving it a new UUID,
    2.14          cloning the VM details, and giving it a new name.  This allows us to
     3.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Wed Nov 08 18:29:16 2006 +0000
     3.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Thu Nov 09 12:36:20 2006 +0000
     3.3 @@ -79,7 +79,7 @@ methods = ['device_create', 'device_conf
     3.4             'destroyDevice','getDeviceSxprs',
     3.5             'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown',
     3.6             'send_sysrq', 'getVCPUInfo', 'waitForDevices',
     3.7 -           'getRestartCount', 'getSysMem']
     3.8 +           'getRestartCount']
     3.9  
    3.10  exclude = ['domain_create', 'domain_restore']
    3.11  
     4.1 --- a/tools/python/xen/xm/main.py	Wed Nov 08 18:29:16 2006 +0000
     4.2 +++ b/tools/python/xen/xm/main.py	Thu Nov 09 12:36:20 2006 +0000
     4.3 @@ -540,7 +540,7 @@ def parse_doms_info(info):
     4.4      return {
     4.5          'domid'    : get_info('domid',        int,   -1),
     4.6          'name'     : get_info('name',         str,   '??'),
     4.7 -        'mem'      : get_info('memory',       int,   0),
     4.8 +        'mem'      : get_info('memory_dynamic_max', int,   0),
     4.9          'vcpus'    : get_info('online_vcpus', int,   0),
    4.10          'state'    : get_info('state',        str,    ''),
    4.11          'cpu_time' : get_info('cpu_time',     float, 0),
    4.12 @@ -563,12 +563,6 @@ def parse_sedf_info(info):
    4.13          }
    4.14  
    4.15  def xm_brief_list(doms):
    4.16 -    def get_mem_info():
    4.17 -       dom_sysMem=server.xend.domain.getSysMem(d['domid'])
    4.18 -       if dom_sysMem:
    4.19 -               d['mem']=dom_sysMem
    4.20 -
    4.21 -
    4.22      print '%-40s %3s %5s %5s %10s %9s' % \
    4.23            ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)')
    4.24      
    4.25 @@ -577,7 +571,6 @@ def xm_brief_list(doms):
    4.26      
    4.27      for dom in doms:
    4.28          d = parse_doms_info(dom)
    4.29 -        get_mem_info()
    4.30          print format % d
    4.31  
    4.32  def xm_label_list(doms):