Configuring the Paravirtualization Interface in Vagrantfile

VirtualBox 5 provides a setting called “Paravirtualization Interface” that can improve performance for some specific guest operating systems.

Is there a way to set this option in a Vagrantfile ?

And anyway: is there any documentation on setting up acceleration through Vagrantfile?

+8
vagrant virtualbox
source share
2 answers

Found. VBoxManage (CLI VirtualBox tool) has an optional argument --paravirtprovider . You can add this to the vb.customize call:

 Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provider "virtualbox" do |vb| vb.customize [ "modifyvm", :id, "--memory", "1024", "--paravirtprovider", "kvm", # for linux guest "--cpus", "2" ] end end 

Other CPU settings are also available in this way, vb.customize accepts the same argument as VBoxManage . See VboxManage --help for a list of all options.

+11
source share

There was no vb.customize section in my Vagrantfile (perhaps the accepted answer uses an older format (?)). Based on https://www.vagrantup.com/docs/virtualbox/configuration.html and https://www.virtualbox.org/manual/ch08.html (search on --nictype), the following worked for me. I did not need to install KVM explicitly because I was on Linux, and that was the default.

 Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.hostname = "whatever" config.vm.provider "virtualbox" do |vb| vb.memory = "512" vb.cpus = "2" vb.default_nic_type = "virtio" end end 

By setting virtio to default_nic_type, this type received not only the first network adapter with NAT, but I also defined the second network adapter (not shown here), and it was also created as virtio (virtio-net in the virtual box parameters GUI).

0
source share

All Articles