mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 18:04:02 -07:00
Correctly count processors on ARM systems. (#52884)
- Add unit tests for Linux CPU info - Add cpuinfo output from several systems for unit tests Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
fa2e8d8fe1
commit
55306906cf
13 changed files with 951 additions and 0 deletions
|
@ -159,6 +159,7 @@ class LinuxHardware(Hardware):
|
|||
i = 0
|
||||
vendor_id_occurrence = 0
|
||||
model_name_occurrence = 0
|
||||
processor_occurence = 0
|
||||
physid = 0
|
||||
coreid = 0
|
||||
sockets = {}
|
||||
|
@ -206,6 +207,8 @@ class LinuxHardware(Hardware):
|
|||
vendor_id_occurrence += 1
|
||||
if key == 'model name':
|
||||
model_name_occurrence += 1
|
||||
if key == 'processor':
|
||||
processor_occurence += 1
|
||||
i += 1
|
||||
elif key == 'physical id':
|
||||
physid = data[1].strip()
|
||||
|
@ -229,6 +232,12 @@ class LinuxHardware(Hardware):
|
|||
if vendor_id_occurrence == model_name_occurrence:
|
||||
i = vendor_id_occurrence
|
||||
|
||||
# The fields for ARM CPUs do not always include 'vendor_id' or 'model name',
|
||||
# and sometimes includes both 'processor' and 'Processor'.
|
||||
# Always use 'processor' count for ARM systems
|
||||
if collected_facts.get('ansible_architecture').startswith(('armv', 'aarch')):
|
||||
i = processor_occurence
|
||||
|
||||
# FIXME
|
||||
if collected_facts.get('ansible_architecture') != 's390x':
|
||||
if xen_paravirt:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue