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) destroy)
echo "[$VM] Destroying VM" 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" echo "[$VM] Destroying ZFS image"
ssh root@$HVN "zfs destroy -r vol0/$VM" ssh root@$HVN "zfs destroy -r vol0/$VM"
;; ;;

2
create
View File

@ -44,4 +44,6 @@ for VM in $VMS; do
ssh root@$HVN "umount $STAGING/$VM; zfs snapshot vol0/${VM}@pristine" ssh root@$HVN "umount $STAGING/$VM; zfs snapshot vol0/${VM}@pristine"
echo "[$VM] Copying libvirt config" echo "[$VM] Copying libvirt config"
scp -q build/${BUILD}/${HVN}/${VM}/root/libvirt.xml root@$HVN:${LABDIR}/${VM}.xml scp -q build/${BUILD}/${HVN}/${VM}/root/libvirt.xml root@$HVN:${LABDIR}/${VM}.xml
echo "[$VM] Defining libvirt config"
ssh root@$HVN "virsh define ${LABDIR}/${VM}.xml"
done done

8
generate-all Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
for o in frr bird; do
for i in `seq 0 3`; do
./generate --host hvn$i.lab.ipng.ch --overlay $o
done
done