Clean up libvirt network

Clean up libvirt network once the script has
finished successfully.
This commit is contained in:
Miguel Martín 2023-11-20 16:13:58 +01:00 committed by Miguel Martin
parent 53955af7ca
commit 38f9687cc1
9 changed files with 33 additions and 0 deletions

View file

@ -331,6 +331,9 @@ clean_up () {
sudo virsh undefine "${IMAGE_KEY}-uefi" --nvram
# Remove qcow2 file.
sudo rm -f "$LIBVIRT_UEFI_IMAGE_PATH"
# Clear integration network
sudo virsh net-destroy integration
sudo virsh net-undefine integration
# Remove any status containers if exist
sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f