Last active
August 10, 2018 21:43
-
-
Save furlongm/79c3966875ba0006a161e75b8315e585 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
delete_empty_bridge() { | |
for v in $(virsh list --all | tail -n +3 | head -n -1 | awk '{print $2}') ; do | |
virsh dumpxml ${v} | |
done | grep br${1} && return | |
ip link delete vlan${1} | |
ip link set down br${1} | |
brctl delbr br${1} | |
} | |
brctl show | |
for b in $(brctl show | awk '/^br[0-9]/ {print $1}') ; do | |
brctl show ${b} | grep -q vnet || delete_empty_bridge ${b:2} | |
done | |
brctl show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment