Rework how OpenBSD processor facts are resolved
(cherry picked from commit c17dad0def
)
This commit is contained in:
parent
5bf1269aaf
commit
9d81ad6423
1 changed files with 12 additions and 13 deletions
|
@ -1574,7 +1574,6 @@ class OpenBSDHardware(Hardware):
|
|||
- devices
|
||||
"""
|
||||
platform = 'OpenBSD'
|
||||
DMESG_BOOT = '/var/run/dmesg.boot'
|
||||
|
||||
def populate(self):
|
||||
self.sysctl = self.get_sysctl()
|
||||
|
@ -1632,19 +1631,19 @@ class OpenBSDHardware(Hardware):
|
|||
|
||||
def get_processor_facts(self):
|
||||
processor = []
|
||||
dmesg_boot = get_file_content(OpenBSDHardware.DMESG_BOOT)
|
||||
if not dmesg_boot:
|
||||
rc, dmesg_boot, err = self.module.run_command("/sbin/dmesg")
|
||||
i = 0
|
||||
for line in dmesg_boot.splitlines():
|
||||
if line.split(' ', 1)[0] == 'cpu%i:' % i:
|
||||
processor.append(line.split(' ', 1)[1])
|
||||
i = i + 1
|
||||
processor_count = i
|
||||
for i in range(int(self.sysctl['hw.ncpu'])):
|
||||
processor.append(self.sysctl['hw.model'])
|
||||
|
||||
self.facts['processor'] = processor
|
||||
self.facts['processor_count'] = processor_count
|
||||
# I found no way to figure out the number of Cores per CPU in OpenBSD
|
||||
self.facts['processor_cores'] = 'NA'
|
||||
# The following is partly a lie because there is no reliable way to
|
||||
# determine the number of physical CPUs in the system. We can only
|
||||
# query the number of logical CPUs, which hides the number of cores.
|
||||
# On amd64/i386 we could try to inspect the smt/core/package lines in
|
||||
# dmesg, however even those have proven to be unreliable.
|
||||
# So take a shortcut and report the logical number of processors in
|
||||
# 'processor_count' and 'processor_cores' and leave it at that.
|
||||
self.facts['processor_count'] = self.sysctl['hw.ncpu']
|
||||
self.facts['processor_cores'] = self.sysctl['hw.ncpu']
|
||||
|
||||
def get_device_facts(self):
|
||||
devices = []
|
||||
|
|
Loading…
Reference in a new issue