lib/beaker/hypervisor/vagrant_virtualbox.rb in beaker-2.19.0 vs lib/beaker/hypervisor/vagrant_virtualbox.rb in beaker-2.20.0
- old
+ new
@@ -14,12 +14,16 @@
def self.vb_customize_vm(command, args)
" vb.customize ['#{command}', :id, #{args.map{|a| "'#{a.to_s}'"}.join(", ")}]\n"
end
def self.provider_vfile_section(host, options)
+ # Allow memory and CPUs to be set at a per node level or overall, and take the most specific setting
+ host_memory = host['vagrant_memsize'] ? host['vagrant_memsize'] : (options['vagrant_memsize'] ? options['vagrant_memsize'] : 1024)
+ host_cpus = host['vagrant_cpus'] ? host['vagrant_cpus'] : (options['vagrant_cpus'] ? options['vagrant_cpus'] : 1)
+
provider_section = ""
provider_section << " v.vm.provider :virtualbox do |vb|\n"
- provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{options['vagrant_memsize'] ||= '1024'}', '--cpus', '#{options['vagrant_cpus'] ||= '1'}']\n"
+ provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{host_memory}', '--cpus', '#{host_cpus}']\n"
provider_section << " vb.vbguest.auto_update = false" if options[:vbguest_plugin] == 'disable'
# Guest volume support
# - Creates a new AHCI controller with the requisite number of ports,
# the default controller is limited in its number of supported ports (2).