Issue #19249 has been updated by Lance Dillon.
To get total processor count, perhaps this, have it call the processorcount
code that uses sysfs. I'm not sure how to get facter to call another specific
fact right yet, especially since this isn't the primary method, but a secondary
method that runs if the primary code returns 0, so I had to embed the sysfs
code directly into the fact, which is probably not the best way to do it:
<pre>
Facter.add("TotalProcessorCount") do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
sysfs_cpu_directory = '/sys/devices/system/cpu'
if File.exists?(sysfs_cpu_directory)
lookup_pattern = "#{sysfs_cpu_directory}" + "/cpu[0-9]*"
cpuCount = Dir.glob(lookup_pattern).length
cpuCount.to_s
end
end
end
</pre>
These two additional facts do give the correct answers. Perhaps have
processorcount return totalprocessorcount as an alias or something?
----------------------------------------
Bug #19249: number of cpus (facts.processorcount) is incorrect
https://projects.puppetlabs.com/issues/19249#change-87515
* 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.