Add virtualization metadata and move kernel to software

This commit adds two new fields in hardware metadata to
identify if the node is baremetal/vm. This will help when running
browbeat using infrared in vms or when the control plane is running
on RHEV/oVirt.

This commit also fixes the long known issue of having kernel details
in hardware metadata.

Change-Id: Ie9dd9d375125ebeae0287c624d345b272e19e459
This commit is contained in:
Sai Sindhur Malleni 2018-07-11 10:05:56 -06:00
parent 4be23046b8
commit b1f4eaeec4
1 changed files with 8 additions and 1 deletions

View File

@ -40,7 +40,8 @@ class Metadata(object):
hard_dict['hardware_details'] = []
hardware_dict = {}
hardware_dict['label'] = item['inventory_hostname']
hardware_dict['kernel'] = item['ansible_kernel']
hardware_dict['virtualization_role'] = item['ansible_virtualization_role']
hardware_dict['virtualization_type'] = item['ansible_virtualization_type']
hardware_dict['total_mem'] = item[
'ansible_memory_mb']['real']['total']
hardware_dict['total_logical_cores'] = item[
@ -102,6 +103,12 @@ class Metadata(object):
software_dict[service_name][section] = {}
software_dict[service_name][section][key] = item[soft]
node = item['inventory_hostname']
software_dict['kernel'] = {}
software_dict['kernel']['version'] = item['ansible_kernel']
software_dict['kernel']['architecture'] = item['ansible_architecture']
software_dict['kernel']['node_name'] = node
soft_all_dict.append(software_dict)
return soft_all_dict