Created
July 6, 2022 17:09
-
-
Save utkuozdemir/d8bbb59789ef65112193c709dd1df99a to your computer and use it in GitHub Desktop.
Clear all KVM machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
virsh list --all | \ | |
awk '{print $2}' | \ | |
xargs -L1 -I {} virsh destroy {} || true | |
virsh list --all | \ | |
awk '{print $2}' | \ | |
xargs -L1 -I {} virsh undefine {} || true | |
virsh vol-list --pool default | \ | |
awk '{ print $1 }' | \ | |
xargs -L1 -I {} virsh vol-delete --pool default {} || true | |
virsh net-list | \ | |
awk '{print $1}' | \ | |
xargs -L1 -I {} virsh net-destroy {} || true | |
vagrant global-status --prune || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment