mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #8097 from BenTheElder/vagrant_cpu_count
Fix vagrant cpu count on linux.
This commit is contained in:
commit
0270fb2d4f
8
Vagrantfile
vendored
8
Vagrantfile
vendored
@ -79,7 +79,13 @@ host = RbConfig::CONFIG['host_os']
|
|||||||
if host =~ /darwin/
|
if host =~ /darwin/
|
||||||
$vm_cpus = `sysctl -n hw.physicalcpu`.to_i
|
$vm_cpus = `sysctl -n hw.physicalcpu`.to_i
|
||||||
elsif host =~ /linux/
|
elsif host =~ /linux/
|
||||||
$vm_cpus = `cat /proc/cpuinfo | grep 'core id' | wc -l`.to_i
|
#This should work on most processors, however it will fail on ones without the core id field.
|
||||||
|
#So far i have only seen this on a raspberry pi. which you probably don't want to run vagrant on anyhow...
|
||||||
|
#But just in case we'll default to the result of nproc if we get 0 just to be safe.
|
||||||
|
$vm_cpus = `cat /proc/cpuinfo | grep 'core id' | uniq | wc -l`.to_i
|
||||||
|
if $vm_cpus < 1
|
||||||
|
$vm_cpus = `nproc`.to_i
|
||||||
|
end
|
||||||
else # sorry Windows folks, I can't help you
|
else # sorry Windows folks, I can't help you
|
||||||
$vm_cpus = 2
|
$vm_cpus = 2
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user