Merge pull request #2800 from miketheman/cpu_vbox_convenince

provider/virtualbox: add `cpus=` configuration
This commit is contained in:
Mitchell Hashimoto 2014-01-10 14:45:35 -08:00
commit 94f45f5747
2 changed files with 10 additions and 2 deletions

View File

@ -84,6 +84,14 @@ module VagrantPlugins
customize("pre-boot", ["modifyvm", :id, "--memory", size.to_s]) customize("pre-boot", ["modifyvm", :id, "--memory", size.to_s])
end end
# Shortcut for setting CPU count for the virtual machine.
# Calls #customize internally.
#
# @param count [Integer, String] the count of CPUs
def cpus=(count)
customize("pre-boot", ["modifyvm", :id, "--cpus", count.to_i])
end
# This is the hook that is called to finalize the object before it # This is the hook that is called to finalize the object before it
# is put into use. # is put into use.
def finalize! def finalize!

View File

@ -62,11 +62,11 @@ more than 50% would be used on your own host machine. Some details:
* Multiple `customize` directives can be used. They will be executed in the * Multiple `customize` directives can be used. They will be executed in the
order given. order given.
There is also a shortcut for specifying the memory size (MB) for the virtual There are some convenience shortcuts for memory and CPU settings:
machine:
```ruby ```ruby
config.vm.provider "virtualbox" do |v| config.vm.provider "virtualbox" do |v|
v.memory = 1024 v.memory = 1024
v.cpus = 2
end end
``` ```