7
echo_info "Cleanup Started..."
9
vm_list=$(sudo virsh list --all)
11
for vm in node1-control node2-compute node3-control node4-control \
12
node5-compute rack-vir-m1 rack-vir-m2 rack-vir-m3 rack-vir-m4 \
15
echo "$vm_list" | grep -q " $vm " || continue
16
sudo virsh destroy $vm
17
sudo virsh undefine --nvram $vm
18
sudo rm -f /var/lib/libvirt/images/${vm}.qcow2
21
echo_info "Cleanup Finished!"
5
#use the below commands if you needs to delete the virtual machine
6
# also along with envuronment destroy.
8
echo " Cleanup Started ..."
11
sudo virsh destroy node1-control || true
12
sudo virsh destroy node3-control || true
13
sudo virsh destroy node4-control || true
14
sudo virsh destroy node2-compute || true
15
sudo virsh destroy node5-compute || true
16
sudo virsh undefine node1-control || true
17
sudo virsh undefine node3-control || true
18
sudo virsh undefine node4-control || true
19
sudo virsh undefine node2-compute || true
20
sudo virsh undefine node5-compute || true
21
sudo rm -rf /var/lib/libvirt/images/node1-control.img /var/lib/libvirt/images/node2-compute.img /var/lib/libvirt/images/node3-control.img /var/lib/libvirt/images/node4-control.img /var/lib/libvirt/images/node5-compute.img || true
23
echo " Cleanup Finished ..."