mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
facts: fix SPARC cpu count on linux (#30261)
On sparc64, /proc/cpuinfo has no usual 'model name', 'Processor', 'vendor_id', 'Vendor', as a result "ansible_processor_vcpus" is always 1. Add check element "ncpus active" to fix the issue.
This commit is contained in:
parent
e1dcfda172
commit
e93ecac0da
1 changed files with 3 additions and 0 deletions
|
@ -193,6 +193,7 @@ class LinuxHardware(Hardware):
|
|||
|
||||
# model name is for Intel arch, Processor (mind the uppercase P)
|
||||
# works for some ARM devices, like the Sheevaplug.
|
||||
# 'ncpus active' is SPARC attribute
|
||||
if key in ['model name', 'Processor', 'vendor_id', 'cpu', 'Vendor', 'processor']:
|
||||
if 'processor' not in cpu_facts:
|
||||
cpu_facts['processor'] = []
|
||||
|
@ -216,6 +217,8 @@ class LinuxHardware(Hardware):
|
|||
cores[coreid] = int(data[1].strip())
|
||||
elif key == '# processors':
|
||||
cpu_facts['processor_cores'] = int(data[1].strip())
|
||||
elif key == 'ncpus active':
|
||||
i = int(data[1].strip())
|
||||
|
||||
# Skip for platforms without vendor_id/model_name in cpuinfo (e.g ppc64le)
|
||||
if vendor_id_occurrence > 0:
|
||||
|
|
Loading…
Reference in a new issue