Merge "on aarch64, libvirt failed to undefine a guest with nvram"
[joid.git] / ci / cleanvm.sh
1 #!/bin/bash
2
3 set -x
4
5 echo " Cleanup Started ..."
6
7 #use the below commands if you needs to delete the virtual machine
8 # also along with environment destroy.
9 ./clean.sh
10
11 vm_list=$(sudo virsh list --all)
12
13 for vm in node1-control node2-compute node3-control node4-control \
14           node5-compute rack-vir-m1 rack-vir-m2 rack-vir-m3 rack-vir-m4 \
15           rack-vir-m1 bootstrap
16 do
17     echo "$vm_list" | grep -q " $vm " || continue
18     sudo virsh destroy $vm
19     sudo virsh undefine --nvram $vm
20     sudo rm -f /var/lib/libvirt/images/${vm}.qcow2
21 done
22
23 echo " Cleanup Finished ..."