Use kstat for Solaris CPU info
This commit is contained in:
parent
dbfad567bc
commit
66c10410ec
1 changed files with 10 additions and 3 deletions
|
@ -655,13 +655,20 @@ class SunOSHardware(Hardware):
|
|||
return self.facts
|
||||
|
||||
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'] = []
|
||||
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:
|
||||
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_count'] = len(self.facts['processor'])
|
||||
|
||||
|
|
Loading…
Reference in a new issue