diff --git a/lib/vagrant-lxc/action/gc_private_network_bridges.rb b/lib/vagrant-lxc/action/gc_private_network_bridges.rb index dc33a92..8bb31f8 100644 --- a/lib/vagrant-lxc/action/gc_private_network_bridges.rb +++ b/lib/vagrant-lxc/action/gc_private_network_bridges.rb @@ -35,8 +35,9 @@ module Vagrant if ! driver.bridge_is_in_use?(bridge) env[:ui].info I18n.t("vagrant_lxc.messages.remove_bridge", name: bridge) - # TODO: Output that bridge is being removed - driver.remove_bridge(bridge) + unless ['lxcbr0', 'virbr0'].include? bridge + driver.remove_bridge(bridge) + end end end end diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index a7d960f..dda638e 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -170,6 +170,11 @@ module Vagrant end def remove_bridge(bridge_name) + if ['lxcbr0', 'virbr0'].include? bridge_name + @logger.info "Skipping removal of system bridge #{bridge_name}" + return + end + @logger.info "Checking whether bridge #{bridge_name} exists" brctl_output = `ifconfig -a | grep -q #{bridge_name}` return if $?.to_i != 0