Flesh out create/destroy/pristine a little bit

This commit is contained in:
Pim van Pelt
2022-10-18 22:53:18 +02:00
parent 65ef59c612
commit 85883eaefb
3 changed files with 58 additions and 0 deletions

14
destroy Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/bin/sh
## Using SSH:
## * Log in to hypervisor, retrieve list of running VMs
## * Log in to hypervisor, retrieve list of ZFS volumes
@ -6,3 +8,15 @@
## * If --force is set:
## * Destroy matching VMs
## * Recursively delete any matching ZFS datasets
BASE=${BASE:=ssd-vol0/hvn0.chbtl0.ipng.ch/ssd-vol0/vpp-proto-disk0@20221018-release}
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"
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"