facts: fix arm64 ansible_processor_vcpus = 0

On arm64, /proc/cpuinfo has no 'model name', 'Processor', 'vendor_id', 'cpu', 'Vendor',
as a resul "ansible_processor_count": 0 & "ansible_processor_vcpus": 0
Add checking element "processor" to fix the issue.

$ ansible -i ~/all-in-one  -m setup all | grep proc
	"ansible_processor": [],
	"ansible_processor_cores": 1,
	"ansible_processor_count": 0,
	"ansible_processor_threads_per_core": 1,
	"ansible_processor_vcpus": 0,

$ cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 100.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x1
CPU part	: 0xd07
CPU revision	: 1

$ ansible --version
ansible 2.3.1.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.9 (default, Aug 13 2016, 16:27:01) [GCC 4.9.2]

With fix, checking processor as well:
$ ansible -i ~/all-in-one  -m setup all | grep proc
	"ansible_processor": [
	"ansible_processor_cores": 1,
	"ansible_processor_count": 16,
	"ansible_processor_threads_per_core": 1,
	"ansible_processor_vcpus": 16,

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
This commit is contained in:
Zhangfei Gao 2017-08-04 22:59:44 +08:00 committed by Brian Coca
parent be5e2251a7
commit ce4ada93f9

View file

@ -193,7 +193,7 @@ class LinuxHardware(Hardware):
# model name is for Intel arch, Processor (mind the uppercase P)
# works for some ARM devices, like the Sheevaplug.
if key in ['model name', 'Processor', 'vendor_id', 'cpu', 'Vendor']:
if key in ['model name', 'Processor', 'vendor_id', 'cpu', 'Vendor', 'processor']:
if 'processor' not in cpu_facts:
cpu_facts['processor'] = []
cpu_facts['processor'].append(data[1].strip())