ia64/xen-unstable

changeset 7833:fcf13f653dba

This patch fixes a number of vcpu related issues.

1. xm vcpu-list now shows info for all vcpus by using
info['max_vcpu_id']+1 as end of the range to query
vcpu_info.
2. Add new vcpu fields, online_vcpus, max_vcpu_id to
XendDomainInfo.sxpr()
3. Remove filter_cpump() which isn't needed now that
the per vcpu cpumap field is correct.
4. Update xm/main.py to use online_vcpus as the number
vcpus to display in list.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Tue Nov 15 17:28:05 2005 +0100 (2005-11-15)
parents 49bf2a4863b6
children 2acbe70dd418
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Nov 15 17:22:42 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Nov 15 17:28:05 2005 +0100
     1.3 @@ -438,8 +438,10 @@ class XendDomainInfo:
     1.4              defaultInfo('cpu',          lambda: None)
     1.5              defaultInfo('cpu_weight',   lambda: 1.0)
     1.6              defaultInfo('vcpus',        lambda: int(1))
     1.7 +            defaultInfo('online_vcpus', lambda: self.info['vcpus'])
     1.8  
     1.9              self.info['vcpus'] = int(self.info['vcpus'])
    1.10 +            defaultInfo('max_vcpu_id',  lambda: self.info['vcpus']-1)
    1.11  
    1.12              defaultInfo('vcpu_avail',   lambda: (1 << self.info['vcpus']) - 1)
    1.13  
    1.14 @@ -927,6 +929,7 @@ class XendDomainInfo:
    1.15          if self.infoIsSet('cpu_time'):
    1.16              sxpr.append(['cpu_time', self.info['cpu_time']/1e9])
    1.17          sxpr.append(['vcpus', self.info['vcpus']])
    1.18 +        sxpr.append(['online_vcpus', self.info['online_vcpus']])
    1.19              
    1.20          if self.infoIsSet('start_time'):
    1.21              up_time =  time.time() - self.info['start_time']
    1.22 @@ -943,16 +946,13 @@ class XendDomainInfo:
    1.23  
    1.24      def getVCPUInfo(self):
    1.25          try:
    1.26 -            def filter_cpumap(map, max):
    1.27 -                return filter(lambda x: x >= 0, map[0:max])
    1.28 -
    1.29              # We include the domain name and ID, to help xm.
    1.30              sxpr = ['domain',
    1.31                      ['domid',      self.domid],
    1.32                      ['name',       self.info['name']],
    1.33 -                    ['vcpu_count', self.info['vcpus']]]
    1.34 +                    ['vcpu_count', self.info['online_vcpus']]]
    1.35  
    1.36 -            for i in range(0, self.info['vcpus']):
    1.37 +            for i in range(0, self.info['max_vcpu_id']+1):
    1.38                  info = xc.vcpu_getinfo(self.domid, i)
    1.39  
    1.40                  sxpr.append(['vcpu',
    1.41 @@ -962,8 +962,7 @@ class XendDomainInfo:
    1.42                               ['running',  info['running']],
    1.43                               ['cpu_time', info['cpu_time'] / 1e9],
    1.44                               ['cpu',      info['cpu']],
    1.45 -                             ['cpumap',   filter_cpumap(info['cpumap'],
    1.46 -                                                        self.info['vcpus'])]])
    1.47 +                             ['cpumap',   info['cpumap']]])
    1.48  
    1.49              return sxpr
    1.50  
     2.1 --- a/tools/python/xen/xm/main.py	Tue Nov 15 17:22:42 2005 +0100
     2.2 +++ b/tools/python/xen/xm/main.py	Tue Nov 15 17:28:05 2005 +0100
     2.3 @@ -260,13 +260,13 @@ def parse_doms_info(info):
     2.4          return t(sxp.child_value(info, n, d))
     2.5      
     2.6      return {
     2.7 -        'dom'      : get_info('domid',    int,   -1),
     2.8 -        'name'     : get_info('name',     str,   '??'),
     2.9 -        'mem'      : get_info('memory',   int,   0),
    2.10 -        'vcpus'    : get_info('vcpus',    int,   0),
    2.11 -        'state'    : get_info('state',    str,   '??'),
    2.12 -        'cpu_time' : get_info('cpu_time', float, 0),
    2.13 -        'ssidref'  : get_info('ssidref',  int,   0),
    2.14 +        'dom'      : get_info('domid',        int,   -1),
    2.15 +        'name'     : get_info('name',         str,   '??'),
    2.16 +        'mem'      : get_info('memory',       int,   0),
    2.17 +        'vcpus'    : get_info('online_vcpus', int,   0),
    2.18 +        'state'    : get_info('state',        str,   '??'),
    2.19 +        'cpu_time' : get_info('cpu_time',     float, 0),
    2.20 +        'ssidref'  : get_info('ssidref',      int,   0),
    2.21          }
    2.22  
    2.23