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