summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Lawrance <stl@redhat.com>2011-03-23 15:42:42 +1000
committerGerrit Code Review <gerrit@maeby.djc.id.au>2011-03-23 15:42:42 +1000
commit445e5b37e865005ecdd1a43edc5a4d3f076938ca (patch)
tree560157788018e43c2cc7389e6d2883258bf7ab4f
parente140ae7a6bb7b3794f77e55b7c6a898e14906ec8 (diff)
parent1a308a22d2004057e8b591bb524dc9d4bb20aeef (diff)
Merge "Gather more sensible CPU info on S390, PPC, IA64." into developbeaker-distribution-inventory-1_1-44beaker-distribution-inventory-1_1-42
-rwxr-xr-xTasks/distribution/inventory/push-inventory.py5
-rwxr-xr-xTasks/distribution/inventory/pushInventory.py90
2 files changed, 60 insertions, 35 deletions
diff --git a/Tasks/distribution/inventory/push-inventory.py b/Tasks/distribution/inventory/push-inventory.py
index 3a35b5b..8d52dde 100755
--- a/Tasks/distribution/inventory/push-inventory.py
+++ b/Tasks/distribution/inventory/push-inventory.py
@@ -257,6 +257,11 @@ def read_inventory():
data['MODEL'] = "%s" % profile.host.systemModel
data['FORMFACTOR'] = "%s" % profile.host.formfactor
+ if data['CPUMODELNUMBER'] == '':
+ data['CPUMODELNUMBER'] = 0
+ if data['CPUFAMILY'] == '':
+ data['CPUFAMILY'] = 0
+
try:
for cpuflag in cpu_info['other'].split(" "):
data['CPUFLAGS'].append(cpuflag)
diff --git a/Tasks/distribution/inventory/pushInventory.py b/Tasks/distribution/inventory/pushInventory.py
index 10ede53..7f33898 100755
--- a/Tasks/distribution/inventory/pushInventory.py
+++ b/Tasks/distribution/inventory/pushInventory.py
@@ -52,46 +52,66 @@ def read_inventory():
memory = smolt.read_memory()
profile = smolt.Hardware()
- try:
+ arch = smoltCpu['platform']
+
+ if arch in ["i386", "x86_64"]:
for cpuflag in procCpu.tags['flags'].split(" "):
flags.append(cpuflag)
- except:
- pass
-
- try:
- cpu = dict( vendor = smoltCpu['type'],
- model = int(procCpu.tags['model']),
- modelName = smoltCpu['model'],
- speed = float(procCpu.tags['cpu mhz']),
- processors = int(procCpu.nr_cpus),
- cores = int(procCpu.nr_cores),
- sockets = int(procCpu.nr_sockets),
- CpuFlags = flags
+ cpu = dict(vendor = smoltCpu['type'],
+ model = int(procCpu.tags['model']),
+ modelName = smoltCpu['model'],
+ speed = float(procCpu.tags['cpu mhz']),
+ processors = int(procCpu.nr_cpus),
+ cores = int(procCpu.nr_cores),
+ sockets = int(procCpu.nr_sockets),
+ CpuFlags = flags,
+ family = int(smoltCpu['model_number']),
+ stepping = int(procCpu.tags['stepping']),
)
- try:
- cpu['family'] = int(smoltCpu['model_number'])
- cpu['stepping'] = int(procCpu.tags['stepping'])
- except:
- cpu['family'] = int(smoltCpu['model_rev'])
- cpu['stepping'] = 0
- pass
-
- except:
- #POWERCASE Hack :(
- cpu = dict( vendor = "IBM",
- model = str(procCpu.tags['machine']),
- modelName = str(procCpu.tags['cpu']),
- speed = str(procCpu.tags['clock']),
- processors = int(procCpu.nr_cpus),
- cores = "N/A",
- sockets = "N/A",
- CpuFlags = flags,
- family = str(procCpu.tags['revision']),
- stepping = 0
+ elif arch in ["ppc", "ppc64"]:
+ cpu = dict(vendor = "IBM",
+ model = str(procCpu.tags['machine']),
+ modelName = str(procCpu.tags['cpu']),
+ speed = str(procCpu.tags['clock']),
+ processors = int(procCpu.nr_cpus),
+ cores = None,
+ sockets = None,
+ CpuFlags = flags,
+ family = str(procCpu.tags['revision']),
+ stepping = None,
+ )
+ elif arch in ["s390", "s390x"]:
+ for cpuflag in procCpu.tags['features'].split(" "):
+ flags.append(cpuflag)
+ proc = dict([tuple(s.strip() for s in kv.split('=')) for kv in procCpu.tags['processor 0'].split(',')])
+ cpu = dict(vendor = str(procCpu.tags['vendor_id']),
+ model = str(proc['machine']),
+ modelName = None,
+ processors = int(procCpu.tags['# processors']),
+ cores = None,
+ sockets = None,
+ CpuFlags = flags,
+ family = None,
+ speed = None,
+ stepping = None,
)
- pass
+ elif arch == "ia64":
+ for cpuflag in procCpu.tags['features'].split(","):
+ flags.append(cpuflag.strip())
+ cpu = dict(vendor = smoltCpu['type'],
+ model = int(procCpu.tags['model']),
+ modelName = smoltCpu['model'],
+ speed = float(procCpu.tags['cpu mhz']),
+ processors = int(procCpu.nr_cpus),
+ cores = int(procCpu.nr_cores),
+ sockets = int(procCpu.nr_sockets),
+ CpuFlags = flags,
+ family = int(smoltCpu['model_rev']),
+ stepping = None,
+ )
+
data['Cpu'] = cpu
- data['Arch'] = [smoltCpu['platform']]
+ data['Arch'] = [arch]
data['vendor'] = "%s" % profile.host.systemVendor
data['model'] = "%s" % profile.host.systemModel
#data['FORMFACTOR'] = "%s" % profile.host.formfactor