Undefine VMs upon destroy; Define VMs upon create

This commit is contained in:
Pim van Pelt
2023-11-19 18:27:46 +00:00
parent b14e7674ad
commit 3d60a51503
3 changed files with 11 additions and 1 deletions

View File

@ -35,7 +35,7 @@ for VM in $VMS; do
;;
destroy)
echo "[$VM] Destroying VM"
ssh root@$HVN "/usr/bin/virsh list --all | grep $VM.*running >/dev/null && virsh destroy $VM"
ssh root@$HVN "/usr/bin/virsh list --all | grep $VM.*running >/dev/null && virsh destroy $VM && virsh undefine $VM"
echo "[$VM] Destroying ZFS image"
ssh root@$HVN "zfs destroy -r vol0/$VM"
;;