Merge pull request #2426 from tmatilai/virtualbox_memory

providers/virtualbox: Add shortcut for setting the memory size for VirtualBox VM
This commit is contained in:
Mitchell Hashimoto 2013-11-23 11:44:13 -08:00
commit 4e75e39ee5
2 changed files with 17 additions and 0 deletions

View File

@ -76,6 +76,14 @@ module VagrantPlugins
@network_adapters[slot] = [type, args]
end
# Shortcut for setting memory size for the virtual machine.
# Calls #customize internally.
#
# @param size [Integer, String] the memory size in MB
def memory=(size)
customize "pre-boot", ["modifyvm", :id, "--memory", size]
end
# This is the hook that is called to finalize the object before it
# is put into use.
def finalize!

View File

@ -61,3 +61,12 @@ 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
order given.
There is also a shortcut for specifying the memory size (MB) for the virtual
machine:
```ruby
config.vm.provider "virtualbox" do |v|
v.memory = 1024
end
```