1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# A Vagrantfile template that can be used for creating machines for libblockdev
# development/testing.
#
# Use 'vagrant up && vagrant ssh' to spawn the default machine (most recent
# Fedora) and ssh into it or e.g. 'vagrant up bd-f29 && vagrant ssh bd-f29' to
# use a Fedora 29 based machine, etc.
#
def os_cpu_cores
case RbConfig::CONFIG['host_os']
when /darwin/
Integer(`sysctl -n hw.ncpu`)
when /linux/
Integer(`getconf _NPROCESSORS_ONLN`)
else
raise StandardError, "Unsupported platform"
end
end
Vagrant.configure("2") do |config|
# common configuration
config.vm.synced_folder "../", "/home/vagrant/libblockdev/",
type: "rsync", rsync__args: ["-a", "-l", "--exclude=misc"] # override the default args
# CHECK THAT THE BELOW OPTIONS ARE OKAY FOR YOUR HW
config.vm.provider :libvirt do |v|
v.memory = "2048"
v.cpus = os_cpu_cores
v.disk_driver :cache => "unsafe"
end
# just some handy stuff to have in shell OOTB
config.vm.provision :shell, inline: <<-SHELL
echo 'alias make="make -j -l4"' >> /home/vagrant/.bashrc
echo 'cd libblockdev' >> /home/vagrant/.bash_history
echo './autogen.sh && ./configure' >> /home/vagrant/.bash_history
SHELL
# install all test dependencies using ansible
config.vm.provision "ansible" do |ansible|
ansible.playbook = "install-test-dependencies.yml"
ansible.extra_vars = { ansible_python_interpreter:"/usr/bin/python3" }
end
config.vm.define "bd-f40", primary: true, autostart: true do |f40|
f40.vm.box = "fedora/40-cloud-base"
end
config.vm.define "bd-f39", primary: false, autostart: false do |f39|
f39.vm.box = "fedora/39-cloud-base"
end
config.vm.define "bd-u2404", primary: false, autostart: false do |u2404|
u2404.vm.box = "generic/ubuntu2404"
end
config.vm.define "bd-debiant", primary: false, autostart: false do |debiant|
debiant.vm.box = "debian/testing64"
end
end
|