From 2e617732bac438c70df060d47645d78eb85f95c1 Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Mon, 10 Aug 2020 16:09:54 +0200 Subject: [PATCH] script/vagrant: split into functions - setup virtualbox Signed-off-by: Pawel Piatek Change-Id: I69516c217a1517d064f88f3700eeb88066568180 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3718 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Karol Latecki --- scripts/vagrant/Vagrantfile | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index fb1c5185b..9079057e9 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -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+