Skip to content

Instantly share code, notes, and snippets.

@furlongm
Last active August 10, 2018 21:43
Show Gist options
  • Save furlongm/79c3966875ba0006a161e75b8315e585 to your computer and use it in GitHub Desktop.
Save furlongm/79c3966875ba0006a161e75b8315e585 to your computer and use it in GitHub Desktop.
#!/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