Workaround vagrant-libvirt bug destroying VMs
[icn.git] / ci / jjb / shell / vagrant-verify.sh
1 #!/bin/bash -l
2 echo "---> vagrant-verify.sh"
3
4 # Ensure we fail the job if any steps fail
5 # Disable 'globbing'
6 set -exuf -o pipefail
7
8 function clean_vm {{
9     # TODO Vagrant has a known issue
10     # (https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1371)
11     # destroying the VMs, so destroy them manually here
12     vagrant destroy -f jump
13     virsh -c qemu:///system destroy vm-machine-1
14     virsh -c qemu:///system undefine --nvram --remove-all-storage vm-machine-1
15     virsh -c qemu:///system destroy vm-machine-2
16     virsh -c qemu:///system undefine --nvram --remove-all-storage vm-machine-2
17 }}
18 trap clean_vm EXIT
19
20 # TODO Improve VM performance by only using cores on the same node
21 #sed -i -e '/^\s\+libvirt.cpus/!b' -e "h;s/\S.*/libvirt.cpuset = '0-21,44-65'/;H;g" Vagrantfile
22
23 vagrant destroy -f
24 vagrant up --no-parallel
25 vagrant ssh jump -c "
26 set -exuf
27 cd /icn
28 sudo su -c 'make {target}'
29 "