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
|
- devices
|
||||||
"""
|
"""
|
||||||
platform = 'OpenBSD'
|
platform = 'OpenBSD'
|
||||||
DMESG_BOOT = '/var/run/dmesg.boot'
|
|
||||||
|
|
||||||
def populate(self):
|
def populate(self):
|
||||||
self.sysctl = self.get_sysctl()
|
self.sysctl = self.get_sysctl()
|
||||||
|
@ -1632,19 +1631,19 @@ class OpenBSDHardware(Hardware):
|
||||||
|
|
||||||
def get_processor_facts(self):
|
def get_processor_facts(self):
|
||||||
processor = []
|
processor = []
|
||||||
dmesg_boot = get_file_content(OpenBSDHardware.DMESG_BOOT)
|
for i in range(int(self.sysctl['hw.ncpu'])):
|
||||||
if not dmesg_boot:
|
processor.append(self.sysctl['hw.model'])
|
||||||
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
|
|
||||||
self.facts['processor'] = processor
|
self.facts['processor'] = processor
|
||||||
self.facts['processor_count'] = processor_count
|
# The following is partly a lie because there is no reliable way to
|
||||||
# I found no way to figure out the number of Cores per CPU in OpenBSD
|
# determine the number of physical CPUs in the system. We can only
|
||||||
self.facts['processor_cores'] = 'NA'
|
# 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):
|
def get_device_facts(self):
|
||||||
devices = []
|
devices = []
|
||||||
|
|
Loading…
Reference in a new issue