Navigation Menu

Skip to content

Commit

Permalink
apt: support to customize available cpus
Browse files Browse the repository at this point in the history
  • Loading branch information
kenhys committed Aug 29, 2017
1 parent dd81025 commit 97f9e79
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/apt/Vagrantfile
Expand Up @@ -33,6 +33,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
node.vm.box_url = vm[:box_url] if vm[:box_url]
node.vm.provision(:shell, :path => "build-deb.sh")
node.vm.provider("virtualbox") do |virtual_box|
system_n_cpus = 1
if File.exist?("/proc/cpuinfo")
system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size
end
if system_n_cpus > 1
vm_n_cpus = system_n_cpus / 2
else
vm_n_cpus = 1
end
virtual_box.cpus = (ENV["VM_CPUS"] || vm_n_cpus).to_i
virtual_box.memory = (ENV["VM_MEMORY"] || 768).to_i
end
end
Expand Down

0 comments on commit 97f9e79

Please sign in to comment.