|
|
@ -655,6 +655,8 @@ class SunOSHardware(Hardware):
|
|
|
|
return self.facts
|
|
|
|
return self.facts
|
|
|
|
|
|
|
|
|
|
|
|
def get_cpu_facts(self):
|
|
|
|
def get_cpu_facts(self):
|
|
|
|
|
|
|
|
physid = 0
|
|
|
|
|
|
|
|
sockets = {}
|
|
|
|
rc, out, err = module.run_command("/usr/bin/kstat cpu_info")
|
|
|
|
rc, out, err = module.run_command("/usr/bin/kstat cpu_info")
|
|
|
|
self.facts['processor'] = []
|
|
|
|
self.facts['processor'] = []
|
|
|
|
for line in out.split('\n'):
|
|
|
|
for line in out.split('\n'):
|
|
|
@ -662,15 +664,33 @@ class SunOSHardware(Hardware):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
data = line.split(None, 1)
|
|
|
|
data = line.split(None, 1)
|
|
|
|
key = data[0].strip()
|
|
|
|
key = data[0].strip()
|
|
|
|
# key "brand" works on Solaris 10
|
|
|
|
# "brand" works on Solaris 10 & 11. "implementation" for Solaris 9.
|
|
|
|
if key == 'brand':
|
|
|
|
if key == 'module':
|
|
|
|
|
|
|
|
brand = ''
|
|
|
|
|
|
|
|
elif key == 'brand':
|
|
|
|
|
|
|
|
brand = data[1].strip()
|
|
|
|
|
|
|
|
elif key == 'implementation':
|
|
|
|
|
|
|
|
processor = brand or data[1].strip()
|
|
|
|
if 'processor' not in self.facts:
|
|
|
|
if 'processor' not in self.facts:
|
|
|
|
self.facts['processor'] = []
|
|
|
|
self.facts['processor'] = []
|
|
|
|
self.facts['processor'].append(data[1].strip())
|
|
|
|
self.facts['processor'].append(processor)
|
|
|
|
# Counting cores on Solaris can be complicated. Leave as-is for now.
|
|
|
|
elif key == 'chip_id':
|
|
|
|
|
|
|
|
physid = data[1].strip()
|
|
|
|
|
|
|
|
if physid not in sockets:
|
|
|
|
|
|
|
|
sockets[physid] = 1
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
sockets[physid] += 1
|
|
|
|
|
|
|
|
# Counting cores on Solaris can be complicated.
|
|
|
|
# https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
|
|
|
|
# https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
|
|
|
|
self.facts['processor_cores'] = 'NA'
|
|
|
|
# Treat 'processor_count' as physical sockets and 'processor_cores' as
|
|
|
|
self.facts['processor_count'] = len(self.facts['processor'])
|
|
|
|
# virtual CPUs visisble to Solaris. Not a true count of cores for modern SPARC as
|
|
|
|
|
|
|
|
# these processors have: sockets -> cores -> threads/virtual CPU.
|
|
|
|
|
|
|
|
if len(sockets) > 0:
|
|
|
|
|
|
|
|
self.facts['processor_count'] = len(sockets)
|
|
|
|
|
|
|
|
self.facts['processor_cores'] = reduce(lambda x, y: x + y, sockets.values())
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.facts['processor_cores'] = 'NA'
|
|
|
|
|
|
|
|
self.facts['processor_count'] = len(self.facts['processor'])
|
|
|
|
|
|
|
|
|
|
|
|
def get_memory_facts(self):
|
|
|
|
def get_memory_facts(self):
|
|
|
|
rc, out, err = module.run_command(["/usr/sbin/prtconf"])
|
|
|
|
rc, out, err = module.run_command(["/usr/sbin/prtconf"])
|
|
|
|