summaryrefslogtreecommitdiffstats
path: root/ci/cleanvm.sh
blob: d4f1f3bdcf4e08eba10e8e772bdb21c8466bcb01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

set -ex

echo " Cleanup Started ..."

#use the below commands if you needs to delete the virtual machine
# also along with envuronment destroy.
./clean.sh || true

vm_list=$(sudo virsh list --all)

for vm in node1-control node2-compute node3-control node4-control \
          node5-compute bootstrap
do
    echo "$vm_list" | grep -q " $vm " || continue
    sudo virsh destroy $vm
    sudo virsh undefine $vm
    sudo rm -f /var/lib/libvirt/images/${vm}.qcow2
done

echo " Cleanup Finished ..."