direct-io.hg

changeset 14268:ae203b55e7c8

xend: more flexibility in gathering data from /proc/cpuinfo

Add ia64 mapping for cpuinfo data and make the case where #vcpu !=
#pcpu more flexible (don't rely on cpu0 existing).

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author kfraser@localhost.localdomain
date Tue Mar 06 11:53:37 2007 +0000 (2007-03-06)
parents c8843678cb9b
children 200d13363a38
files tools/python/xen/xend/XendNode.py
line diff
     1.1 --- a/tools/python/xen/xend/XendNode.py	Mon Mar 05 16:22:21 2007 -0600
     1.2 +++ b/tools/python/xen/xend/XendNode.py	Tue Mar 06 11:53:37 2007 +0000
     1.3 @@ -22,7 +22,7 @@ import xen.lowlevel.xc
     1.4  
     1.5  from xen.util import Brctl
     1.6  
     1.7 -from xen.xend import uuid
     1.8 +from xen.xend import uuid, arch
     1.9  from xen.xend.XendError import *
    1.10  from xen.xend.XendOptions import instance as xendoptions
    1.11  from xen.xend.XendQCoWStorageRepo import XendQCoWStorageRepo
    1.12 @@ -98,20 +98,37 @@ class XendNode:
    1.13              log.error(self.cpus[u])
    1.14              number = self.cpus[u]['number']
    1.15              # We can run off the end of the cpuinfo list if domain0 does not
    1.16 -            # have #vcpus == #pcpus. In that case we just replicate pcpu0 info.
    1.17 +            # have #vcpus == #pcpus. In that case we just replicate one that's
    1.18 +            # in the hash table.
    1.19              if not cpuinfo.has_key(number):
    1.20 -                number = 0
    1.21 +                number = cpuinfo.keys()[0]
    1.22              log.error(number)
    1.23              log.error(cpuinfo)
    1.24 -            self.cpus[u].update(
    1.25 -                { 'host'     : self.uuid,
    1.26 -                  'features' : cpu_features,
    1.27 -                  'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
    1.28 -                  'vendor'   : cpuinfo[number]['vendor_id'],
    1.29 -                  'modelname': cpuinfo[number]['model name'],
    1.30 -                  'stepping' : cpuinfo[number]['stepping'],
    1.31 -                  'flags'    : cpuinfo[number]['flags'],
    1.32 -                })
    1.33 +            if arch.type == "x86":
    1.34 +                self.cpus[u].update(
    1.35 +                    { 'host'     : self.uuid,
    1.36 +                      'features' : cpu_features,
    1.37 +                      'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
    1.38 +                      'vendor'   : cpuinfo[number]['vendor_id'],
    1.39 +                      'modelname': cpuinfo[number]['model name'],
    1.40 +                      'stepping' : cpuinfo[number]['stepping'],
    1.41 +                      'flags'    : cpuinfo[number]['flags'],
    1.42 +                    })
    1.43 +            elif arch.type == "ia64":
    1.44 +                self.cpus[u].update(
    1.45 +                    { 'host'     : self.uuid,
    1.46 +                      'features' : cpu_features,
    1.47 +                      'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
    1.48 +                      'vendor'   : cpuinfo[number]['vendor'],
    1.49 +                      'modelname': cpuinfo[number]['family'],
    1.50 +                      'stepping' : cpuinfo[number]['model'],
    1.51 +                      'flags'    : cpuinfo[number]['features'],
    1.52 +                    })
    1.53 +            else:
    1.54 +                self.cpus[u].update(
    1.55 +                    { 'host'     : self.uuid,
    1.56 +                      'features' : cpu_features,
    1.57 +                    })
    1.58  
    1.59          self.pifs = {}
    1.60          self.pif_metrics = {}