Commit e0a8a21d authored by Karol Latecki's avatar Karol Latecki Committed by Tomasz Zawadzki
Browse files

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: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477805


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
parent f1d47d69
Loading
Loading
Loading
Loading
+29 −11
Original line number Diff line number Diff line
@@ -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,12 +78,28 @@ Vagrant.configure(2) do |config|
  end

  # use http proxy if avaiable
  if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
  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)
  vmram=(ENV['SPDK_VAGRANT_VMRAM'] || 4096)
  spdk_dir=(ENV['SPDK_DIR'] || "none")
@@ -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