All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] more flexibility in gathering data from /proc/cpuinfo
@ 2007-03-05 19:42 Alex Williamson
  0 siblings, 0 replies; only message in thread
From: Alex Williamson @ 2007-03-05 19:42 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel


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

	Alex

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

diff -r 53589c343d46 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py	Mon Mar 05 18:10:41 2007 +0000
+++ b/tools/python/xen/xend/XendNode.py	Mon Mar 05 12:04:38 2007 -0700
@@ -22,7 +22,7 @@ import xen.lowlevel.xc
 
 from xen.util import Brctl
 
-from xen.xend import uuid
+from xen.xend import uuid, arch
 from xen.xend.XendError import *
 from xen.xend.XendOptions import instance as xendoptions
 from xen.xend.XendQCoWStorageRepo import XendQCoWStorageRepo
@@ -98,20 +98,37 @@ class XendNode:
             log.error(self.cpus[u])
             number = self.cpus[u]['number']
             # We can run off the end of the cpuinfo list if domain0 does not
-            # have #vcpus == #pcpus. In that case we just replicate pcpu0 info.
+            # have #vcpus == #pcpus. In that case we just replicate one that's
+            # in the hash table.
             if not cpuinfo.has_key(number):
-                number = 0
+                number = cpuinfo.keys()[0]
             log.error(number)
             log.error(cpuinfo)
-            self.cpus[u].update(
-                { 'host'     : self.uuid,
-                  'features' : cpu_features,
-                  'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
-                  'vendor'   : cpuinfo[number]['vendor_id'],
-                  'modelname': cpuinfo[number]['model name'],
-                  'stepping' : cpuinfo[number]['stepping'],
-                  'flags'    : cpuinfo[number]['flags'],
-                })
+            if arch.type == "x86":
+                self.cpus[u].update(
+                    { 'host'     : self.uuid,
+                      'features' : cpu_features,
+                      'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
+                      'vendor'   : cpuinfo[number]['vendor_id'],
+                      'modelname': cpuinfo[number]['model name'],
+                      'stepping' : cpuinfo[number]['stepping'],
+                      'flags'    : cpuinfo[number]['flags'],
+                    })
+            elif arch.type == "ia64":
+                self.cpus[u].update(
+                    { 'host'     : self.uuid,
+                      'features' : cpu_features,
+                      'speed'    : int(float(cpuinfo[number]['cpu MHz'])),
+                      'vendor'   : cpuinfo[number]['vendor'],
+                      'modelname': cpuinfo[number]['family'],
+                      'stepping' : cpuinfo[number]['model'],
+                      'flags'    : cpuinfo[number]['features'],
+                    })
+            else:
+                self.cpus[u].update(
+                    { 'host'     : self.uuid,
+                      'features' : cpu_features,
+                    })
 
         self.pifs = {}
         self.pif_metrics = {}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-05 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05 19:42 [PATCH] more flexibility in gathering data from /proc/cpuinfo Alex Williamson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.