From 2d4c4e09dbf3df5a76af6dfbaceb5e0e1a086cd2 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 16 Nov 2017 06:22:32 +0000 Subject: [PATCH] Add vmware fact about 'Cores Per Socket' (#32881) This fix adds new fact - 'Cores Per Socket' about vmware guest machine. Also, adds integration test for this change. Signed-off-by: Abhijeet Kasurde --- lib/ansible/module_utils/vmware.py | 1 + test/integration/targets/vmware_guest_facts/tasks/main.yml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index d418f92c908..1a10e70353a 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -274,6 +274,7 @@ def gather_vm_facts(content, vm): 'hw_guest_id': vm.summary.guest.guestId, 'hw_product_uuid': vm.config.uuid, 'hw_processor_count': vm.config.hardware.numCPU, + 'hw_cores_per_socket': vm.config.hardware.numCoresPerSocket, 'hw_memtotal_mb': vm.config.hardware.memoryMB, 'hw_interfaces': [], 'guest_tools_status': _get_vm_prop(vm, ('guest', 'toolsRunningStatus')), diff --git a/test/integration/targets/vmware_guest_facts/tasks/main.yml b/test/integration/targets/vmware_guest_facts/tasks/main.yml index 8f4f98020eb..3edcf7dc082 100644 --- a/test/integration/targets/vmware_guest_facts/tasks/main.yml +++ b/test/integration/targets/vmware_guest_facts/tasks/main.yml @@ -67,6 +67,7 @@ that: - "guest_facts_0001['instance']['hw_name'] == vm1 | basename" - "guest_facts_0001['instance']['hw_product_uuid'] is defined" + - "guest_facts_0001['instance']['hw_cores_per_socket'] is defined" - set_fact: vm1_uuid="{{ guest_facts_0001['instance']['hw_product_uuid'] }}" @@ -90,6 +91,7 @@ - "guest_facts_0002['instance']['hw_name'] == vm1 | basename" - "guest_facts_0002['instance']['hw_product_uuid'] is defined" - "guest_facts_0002['instance']['hw_product_uuid'] == vm1_uuid" + - "guest_facts_0002['instance']['hw_cores_per_socket'] is defined" # Testcase 0003: Get details about virtual machines without snapshots using UUID - name: get empty list of snapshots from virtual machine using UUID @@ -151,4 +153,4 @@ - "guest_facts_0004['instance']['snapshots'] is defined" - "guest_facts_0004['instance']['snapshots'][0]['name'] == 'snap1'" - "guest_facts_0004['instance']['snapshots'][1]['name'] == 'snap2'" - - "guest_facts_0004['instance']['current_snapshot']['name'] == 'snap2'" \ No newline at end of file + - "guest_facts_0004['instance']['current_snapshot']['name'] == 'snap2'"