vagrant-libvirt uses NFS to mount external directories

Change-Id: I3a731116049945b2fbf293d635873264b40f36d0
diff --git a/Vagrantfile b/Vagrantfile
index 3294e13..089bb9e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -1,14 +1,6 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-# Look at the command line arguments and the environment to
-# determine the provider being used
-if ARGV[1] and (ARGV[1].split('=')[0] == "--provider" or ARGV[2])
-  provider = (ARGV[1].split('=')[1] || ARGV[2])
-else
-  provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
-end
-
 Vagrant.configure(2) do |config|
 
   if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
@@ -20,6 +12,7 @@
   config.vm.define "corddev" do |d|
     d.ssh.forward_agent = true
     d.vm.box = "ubuntu/trusty64"
+    d.vm.synced_folder '.', '/vagrant', disable: true
     d.vm.hostname = "corddev"
     d.vm.network "private_network", ip: "10.100.198.200"
     d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
@@ -27,15 +20,8 @@
     d.vm.provider "virtualbox" do |v|
       v.memory = 2048
     end
-
-    # The libvirt provider is not handling mounts "normally", so for now get the source into the VM
-    # via an rsync
-    if provider == "libvirt"
-      d.vm.synced_folder '../', '/cord', type: 'rsync', rsync__args: ["--verbose", "--archive", "--delete", "-z"]
-      d.vm.synced_folder '.', '/vagrant', type: 'rsync', disabled: true
-      d.vm.provider :libvirt do |domain|
-        domain.memory = 2048
-      end
+    d.vm.provider :libvirt do |v|
+      v.memory = 2048
     end
   end
 
diff --git a/scripts/cord-in-a-box.sh b/scripts/cord-in-a-box.sh
index 4c4a026..d645b0c 100755
--- a/scripts/cord-in-a-box.sh
+++ b/scripts/cord-in-a-box.sh
@@ -57,7 +57,7 @@
   sudo apt-get update
   [ -e vagrant_1.8.5_x86_64.deb ] || wget https://releases.hashicorp.com/vagrant/1.8.5/vagrant_1.8.5_x86_64.deb
   sudo dpkg -i vagrant_1.8.5_x86_64.deb
-  sudo apt-get -y install qemu-kvm libvirt-bin libvirt-dev curl
+  sudo apt-get -y install qemu-kvm libvirt-bin libvirt-dev curl nfs-kernel-server
 
   [ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
   cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
@@ -99,7 +99,8 @@
 function cloudlab_setup() {
   if [ -e /usr/testbed/bin/mkextrafs ]
   then
-    sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/var/lib/libvirt/images/"
+    # Sometimes this command fails on the first try
+    sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/var/lib/libvirt/images/" || sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/var/lib/libvirt/images/"
 
     cd $CORDDIR/build
     SRC="#- 'on_cloudlab=True'"