Commit 2e617732 authored by Pawel Piatek's avatar Pawel Piatek Committed by Tomasz Zawadzki
Browse files

script/vagrant: split into functions - setup virtualbox



Signed-off-by: default avatarPawel Piatek <pawelx.piatek@intel.com>
Change-Id: I69516c217a1517d064f88f3700eeb88066568180
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3718


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent b9e3b917
Loading
Loading
Loading
Loading
+21 −16
Original line number Diff line number Diff line
@@ -207,6 +207,25 @@ def deploy_test_vm(config)
  end
end

def setup_virtualbox(config, vmcpu, vmram)
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--ioapic", "on"]
    vb.memory = vmram
    vb.cpus = vmcpu

    nvme_disk=(ENV['NVME_FILE'] || "nvme_disk.img")
    unless File.exist? (nvme_disk)
      vb.customize ["createhd", "--filename", nvme_disk, "--variant", "Fixed", "--size", "1024"]
      vb.customize ["storagectl", :id, "--name", "nvme", "--add", "pcie", "--controller", "NVMe", "--portcount", "1", "--bootable", "off"]
      vb.customize ["storageattach", :id, "--storagectl", "nvme", "--type", "hdd", "--medium", nvme_disk, "--port", "0"]
    end

    #support for the SSE4.x instruction is required in some versions of VB.
    vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
    vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
  end
end

Vagrant.configure(2) do |config|

  # Pick the right distro and bootstrap, default is fedora30
@@ -279,22 +298,8 @@ Vagrant.configure(2) do |config|
  # Setup SSH
  setup_ssh(config)

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--ioapic", "on"]
    vb.memory = vmram
    vb.cpus = vmcpu

    nvme_disk=(ENV['NVME_FILE'] || "nvme_disk.img")
    unless File.exist? (nvme_disk)
      vb.customize ["createhd", "--filename", nvme_disk, "--variant", "Fixed", "--size", "1024"]
      vb.customize ["storagectl", :id, "--name", "nvme", "--add", "pcie", "--controller", "NVMe", "--portcount", "1", "--bootable", "off"]
      vb.customize ["storageattach", :id, "--storagectl", "nvme", "--type", "hdd", "--medium", nvme_disk, "--port", "0"]
    end

    #support for the SSE4.x instruction is required in some versions of VB.
    vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
    vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
  end
  # Virtualbox configuration
  setup_virtualbox(config,vmcpu,vmram)

  # This setup was Tested on Fedora 27
  # libvirt configuration need modern Qemu(tested on 2.10) & vagrant-libvirt in version 0.0.39+