Skip to content

Commit

Permalink
Win setup processor (ansible#61425)
Browse files Browse the repository at this point in the history
* Fix incorrect processor information

Fixes Issue ansible#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 <[email protected]>
  • Loading branch information
jborean93 and jdkaufman01 authored Aug 28, 2019
1 parent 161c1ce commit a95f9c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ansible/modules/windows/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
}

Expand Down

0 comments on commit a95f9c6

Please sign in to comment.