diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index ce9ae8741..b5552d467 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -31,12 +31,6 @@ Vagrant.configure(2) do |config| when "freebsd11" #See: https://app.vagrantup.com/generic/boxes/freebsd11 config.vm.box = "generic/freebsd11" - if File.file?(File.expand_path("~/vagrant_pkg.conf")) - config.vm.provision "file", source: "~/vagrant_pkg.conf", destination: "pkg.conf" - config.vm.provision "shell", inline: "sudo mv pkg.conf /usr/local/etc/pkg.conf" - config.vm.provision "shell", inline: "sudo chown root:wheel /usr/local/etc/pkg.conf" - config.vm.provision "shell", inline: "sudo chmod 644 /usr/local/etc/pkg.conf" - end when "freebsd12" #See: https://app.vagrantup.com/generic/boxes/freebsd12 config.vm.box = "generic/freebsd12" @@ -84,10 +78,26 @@ Vagrant.configure(2) do |config| end # use http proxy if avaiable - if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = ENV['http_proxy'] - config.proxy.https = ENV['https_proxy'] - config.proxy.no_proxy = "localhost,127.0.0.1" + if ENV['http_proxy'] + if Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + # Proxyconf does not seem to support FreeBSD boxes or at least it's + # docs do not mention that. Set up proxy configuration manually. + if distro.include?("freebsd") + $freebsd_proxy = <<-SCRIPT + sudo -s + echo "export http_proxy=#{ENV['http_proxy']}" >> /etc/profile + echo "export https_proxy=#{ENV['http_proxy']}" >> /etc/profile + echo "pkg_env: {http_proxy: #{ENV['http_proxy']}}" > /usr/local/etc/pkg.conf + chown root:wheel /usr/local/etc/pkg.conf + chmod 644 /usr/local/etc/pkg.conf + SCRIPT + config.vm.provision "shell", inline: $freebsd_proxy + end end vmcpu=(ENV['SPDK_VAGRANT_VMCPU'] || 2) @@ -126,6 +136,13 @@ Vagrant.configure(2) do |config| config.vm.provider "libvirt" do |libvirt, override| libvirt.random_hostname = "1" libvirt.disk_bus = "virtio" + + # generic/freebsd boxes need to be explicitly run with SCSI bus, + # otherwise boot process fails on mounting the disk + if (distro.include?("freebsd")) + libvirt.disk_bus = "scsi" + end + if not vmemulator.empty? libvirt.emulator_path = "#{vmemulator}" end @@ -179,7 +196,8 @@ Vagrant.configure(2) do |config| end # rsync the spdk directory if provision hasn't happened yet - if ENV['COPY_SPDK_DIR'] == "1" && spdk_dir != "none" + # Warning: rsync does not work with freebsd boxes, so this step is disabled + if ENV['COPY_SPDK_DIR'] == "1" && spdk_dir != "none" && !distro.include?("freebsd") config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", type: "rsync", rsync__auto: false end