From 8d4bc84a8a5a04139905552a145fc7963451f4bb Mon Sep 17 00:00:00 2001 From: Cameron Eagans Date: Wed, 16 Sep 2015 11:40:23 -0600 Subject: [PATCH] Use the kvm paravirt provider if Virtualbox >= 5.0.0 --- README.md | 1 + Vagrantfile | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index e886431..9c65cc1 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Before launching your Dashbrew environment, you must install VirtualBox and Vagr * [Vagrant >= 1.6.5](http://www.vagrantup.com/) * [VirtualBox 4.3.x](https://www.virtualbox.org/) + * Note that installing Virtualbox 5.x is *strongly* recommended for better performance. * [Vagrant Hosts Provisioner plugin](https://github.com/mdkholy/vagrant-hosts-provisioner) for managing the /etc/hosts file of both the host and guest machines. * ``$ vagrant plugin install vagrant-hosts-provisioner`` diff --git a/Vagrantfile b/Vagrantfile index e5e47a2..b60339f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,6 +29,15 @@ Vagrant.configure(2) do |config| vb.customize ["modifyvm", :id, "--cpus", "1"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + + # If Virtualbox is version 5.0.0 or higher, enable the kvm paravirtualization + # provider for better performance. + begin + if VagrantPlugins::ProviderVirtualBox::Driver::Meta.new.version >= "5.0.0" + vb.customize ['modifyvm', :id, '--paravirtprovider', 'kvm'] + end + rescue Vagrant::Errors::VirtualBoxNotDetected + end end # Synced Folders