scripts/vagrant: Adjust Vagrantfile for FreeBSD boxes

- Use "scsi" libvirt disk bus
  generic/freebsd boxes do not boot with default
  "virtio" bus
- Manually provision proxy settings
  Proxyconf plugin seems to not work with generic/freebsd boxes.
  Adjust shell and pkg proxy settings manually via scripts.
- Disable synced_folders provisioning
  FreeBSD boxes don't have rsync and NFS installed by default.
  Vagrantfile "synced_folders" step executes before "priovision"
  steps responsible for setting proxiy settings, therefore we
  are unable to install it.

Change-Id: I1386ec6e89cff6b8412e97e4df95a6149da2a02c
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477805
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Karol Latecki 2019-12-12 13:28:09 +01:00 committed by Tomasz Zawadzki
parent f1d47d69ef
commit e0a8a21dab

View File

@ -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