From a95f9c66401e99e72a12cb9d3a6d6c828bc1ecfe Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 28 Aug 2019 21:29:10 +1000 Subject: [PATCH] Win setup processor (#61425) * Fix incorrect processor information Fixes Issue #45869 Windows Processor Information Incorrect from Setup * set ansible_processor as list of all cores and threads (mirroring POSIX facts) * change to $win32_cs.NumberOfLogicalProcessors to calculate $cpu_list * Simplify vcpus count source Co-authored-by: Jesse Kaufman --- lib/ansible/modules/windows/setup.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/windows/setup.ps1 b/lib/ansible/modules/windows/setup.ps1 index ba63698e4cc..652d2b0b723 100644 --- a/lib/ansible/modules/windows/setup.ps1 +++ b/lib/ansible/modules/windows/setup.ps1 @@ -362,7 +362,7 @@ if($gather_subset.Contains('processor')) { } $cpu_list = @( ) - for ($i=1; $i -le ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors); $i++) { + for ($i=1; $i -le $win32_cs.NumberOfLogicalProcessors; $i++) { $cpu_list += $win32_cpu.Manufacturer $cpu_list += $win32_cpu.Name } @@ -371,8 +371,8 @@ if($gather_subset.Contains('processor')) { ansible_processor = $cpu_list ansible_processor_cores = $win32_cpu.NumberOfCores ansible_processor_count = $win32_cs.NumberOfProcessors - ansible_processor_threads_per_core = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors / $win32_cpu.NumberOfCores) - ansible_processor_vcpus = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors) + ansible_processor_threads_per_core = ($win32_cpu.NumberOfLogicalProcessors / $win32_cpu.NumberofCores) + ansible_processor_vcpus = $win32_cs.NumberOfLogicalProcessors } }