X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Fcleanvm.sh;h=3756c406bce547047394d2e00b0efd564d7967eb;hb=e095e9e24eacbd0aacc92f0d58461c2d7f7e7834;hp=0cb513e0e515d26712e68f6f2f4239669473088a;hpb=4319c23ea317142a73a73da48f77aec52cf904a0;p=joid.git diff --git a/ci/cleanvm.sh b/ci/cleanvm.sh old mode 100644 new mode 100755 index 0cb513e0..3756c406 --- a/ci/cleanvm.sh +++ b/ci/cleanvm.sh @@ -1,21 +1,22 @@ #!/bin/bash -set -ex +set -x + +echo " Cleanup Started ..." #use the below commands if you needs to delete the virtual machine # also along with envuronment destroy. - -echo " Cleanup Started ..." ./clean.sh - -virsh destroy opnfv-maas || true -virsh destroy bootstrap || true -virsh destroy node1-control || true -virsh destroy node2-compute || true -virsh undefine opnfv-maas || true -virsh undefine bootstrap || true -virsh undefine node1-control || true -virsh undefine node2-compute || true -sudo rm -rf /var/lib/libvirt/images/bootstrap.img /var/lib/libvirt/images/node1-control.img /var/lib/libvirt/images/node2-compute.img || 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 ..."