Use kstat for Solaris CPU info
This commit is contained in:
parent
4a215203ed
commit
50c3cf302c
1 changed files with 10 additions and 3 deletions
13
system/setup
13
system/setup
|
@ -655,13 +655,20 @@ class SunOSHardware(Hardware):
|
||||||
return self.facts
|
return self.facts
|
||||||
|
|
||||||
def get_cpu_facts(self):
|
def get_cpu_facts(self):
|
||||||
rc, out, err = module.run_command("/usr/sbin/psrinfo -v")
|
rc, out, err = module.run_command("/usr/sbin/kstat cpu_info")
|
||||||
self.facts['processor'] = []
|
self.facts['processor'] = []
|
||||||
for line in out.split('\n'):
|
for line in out.split('\n'):
|
||||||
if 'processor operates' in line:
|
if len(line) < 1:
|
||||||
|
continue
|
||||||
|
data = line.split(None, 1)
|
||||||
|
key = data[0].strip()
|
||||||
|
# key "brand" works on Solaris 10
|
||||||
|
if key == 'brand':
|
||||||
if 'processor' not in self.facts:
|
if 'processor' not in self.facts:
|
||||||
self.facts['processor'] = []
|
self.facts['processor'] = []
|
||||||
self.facts['processor'].append(line.strip())
|
self.facts['processor'].append(data[1].strip())
|
||||||
|
# Counting cores on Solaris can be complicated. Leave as-is for now.
|
||||||
|
# https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
|
||||||
self.facts['processor_cores'] = 'NA'
|
self.facts['processor_cores'] = 'NA'
|
||||||
self.facts['processor_count'] = len(self.facts['processor'])
|
self.facts['processor_count'] = len(self.facts['processor'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue