Issue #19249 has been updated by Lance Dillon.

Did a little debugging, saw that it did Facter::Util::Processor.enum_cpuinfo, 
which gets a list of all the cpus indexed by processor number.  Since some cpus 
in the middle are disabled, this list is this on the test system:

<pre>
["Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", "Intel(R) Xeon(R) CPU E7- 8870  @ 
2.40GHz", "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", nil, nil, nil, nil, nil, 
nil, nil, "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", "Intel(R) Xeon(R) CPU E7- 
8870  @ 2.40GHz", "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", nil, nil, nil, 
nil, nil, nil, nil, "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", "Intel(R) 
Xeon(R) CPU E7- 8870  @ 2.40GHz", "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", 
nil, nil, nil, nil, nil, nil, nil, "Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", 
"Intel(R) Xeon(R) CPU E7- 8870  @ 2.40GHz", "Intel(R) Xeon(R) CPU E7- 8870  @ 
2.40GHz"]
</pre>
The nil values in the middle of the list are turned off processors, items that 
it didn't enumerate so got filled with nil values in the array.  Since 
processor.rb, ProcessorCount just uses processor_list.length as the number of 
cpus, it gets the incorrect value of processors as the length of the list.  
Could be changed to

<pre>processor_list.select { |x| x }.length</pre>

to get a more accurate count of the active processors.  Or, possibly, add 
another fact for ActiveProcessorCount, separate from ProcessorCount (or maybe 
TotalProcessorCount).

<pre>
Facter.add("ActiveProcessorCount") do
  confine :kernel => [ :linux, :"gnu/kfreebsd" ]
  setcode do
    processor_list = Facter::Util::Processor.enum_cpuinfo

    aprocs = processor_list.select { |x| x }
    if aprocs.length != 0
      aprocs.length.to_s
    end
  end
end
</pre>



----------------------------------------
Bug #19249: number of cpus (facts.processorcount) is incorrect
https://projects.puppetlabs.com/issues/19249#change-87512

* Author: Lance Dillon
* Status: Needs More Information
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Keywords: 
* Branch: 
* Affected Facter version: 1.6.9
----------------------------------------
Facter is counting number of processors incorrectly. It appears to be taking 
the highest number of processor and adding 1 (for 0 based counting). On some 
architectures, some memory is only accessible through a specific socket, so you 
need to have at least one core per socket, so disabling processors isn't done 
from the end, but in a round-robin fashion. We have a machine that has 
processors 0,1,2, 10,11,12, 20,21,22, 30,31,32 active, others disabled, but 
facter reports 33 processors by adding 1 to the last processor 32. It should 
actually count all the processors to get an accurate number, in this case 12.

Occurring on at least facter version 1.6.9.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to