Add lab-build snippets and executing them in 'create'. Refactor create/destroy/pristine; also, only virsh destroy VMs if they are 'running'
This commit is contained in:
12
destroy
12
destroy
@ -10,13 +10,17 @@
|
||||
## * Recursively delete any matching ZFS datasets
|
||||
|
||||
BASE=${BASE:=ssd-vol0/hvn0.chbtl0.ipng.ch/ssd-vol0/vpp-proto-disk0@20221018-release}
|
||||
BUILD=${BUILD:=default}
|
||||
LAB=${LAB:=0}
|
||||
|
||||
## Do not touch below this line
|
||||
HVN="hvn${LAB}.lab.ipng.ch"
|
||||
|
||||
echo "* Destroying VMs"
|
||||
ssh root@$HVN "set -x; for node in 0 1 2 3; do VM=vpp${LAB}-\${node}; virsh destroy \$VM; done"
|
||||
VMS=$(ls -1 build/${BUILD}/${HVN}/)
|
||||
|
||||
echo "* Destroying ZFS datasets"
|
||||
ssh root@$HVN "set -x; for node in 0 1 2 3; do VM=vpp${LAB}-\${node}; zfs destroy -r ssd-vol0/\$VM; done"
|
||||
for VM in $VMS; do
|
||||
echo "[$VM] Destroying VM"
|
||||
ssh root@$HVN "/usr/bin/virsh list --all | grep $VM.*running >/dev/null && virsh destroy $VM"
|
||||
echo "[$VM] Destroying ZFS datasets"
|
||||
ssh root@$HVN "zfs destroy -r ssd-vol0/$VM"
|
||||
done
|
||||
|
Reference in New Issue
Block a user