diff options
Diffstat (limited to 'libvirt-cleanup.sh')
-rw-r--r-- | libvirt-cleanup.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libvirt-cleanup.sh b/libvirt-cleanup.sh new file mode 100644 index 0000000..5166f2b --- /dev/null +++ b/libvirt-cleanup.sh @@ -0,0 +1,18 @@ +#!/bin/sh +arch="$(uname -m)" +domains="$(virsh list --all --name | grep test-ipxe-ipv.-${arch})" +networks="$(virsh net-list --all --name | grep test-ipxe-ipv.-${arch})" + +for domain in $domains; do + if virsh list --name | grep -q $domain; then + virsh destroy $domain + fi + virsh undefine --nvram $domain +done + +for network in $networks; do + if virsh net-list --name | grep -q $domain; then + virsh net-destroy $network + fi + virsh net-undefine $network +done |