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.
(cherry picked from commit e93ecac0da
)
This commit is contained in:
parent
3680d28e58
commit
3aa7941b72
2 changed files with 4 additions and 0 deletions
|
@ -39,6 +39,7 @@ Ansible Changes By Release
|
|||
* Fix encoding error when there are nonascii values in the path to the ssh binary
|
||||
* removed YAML inventory group name validation, broke existing setups and should be global in any case, and configurable
|
||||
* performance improvment for inventory, had slown down considerably from 2.3
|
||||
* Fix cpu facts on sparc64 (https://github.com/ansible/ansible/pull/30261)
|
||||
|
||||
<a id="2.4"></a>
|
||||
|
||||
|
|
|
@ -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