From d2c032a0732c49b011ad0af351289ba6a6fbcb99 Mon Sep 17 00:00:00 2001 From: Andriy Date: Mon, 16 Mar 2015 19:34:40 +0200 Subject: [PATCH 1/5] Update driver.rb Fixing https://github.com/fgrehm/vagrant-lxc/issues/353 issue --- lib/vagrant-lxc/driver.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 9fe0993..1f54377 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -172,6 +172,11 @@ module Vagrant end def remove_bridge(bridge_name) + if bridge_name == "lxcbr0" + @logger.info "Skipping removal 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 From 5329e8837e4e76b1f20a7c62ca8f76000e8ebb3a Mon Sep 17 00:00:00 2001 From: Andriy Date: Mon, 23 Mar 2015 11:03:22 +0200 Subject: [PATCH 2/5] Update gc_private_network_bridges.rb --- lib/vagrant-lxc/action/gc_private_network_bridges.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/action/gc_private_network_bridges.rb b/lib/vagrant-lxc/action/gc_private_network_bridges.rb index dc33a92..c6d358e 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) + if bridge_name != "lxcbr0" + driver.remove_bridge(bridge) + end end end end From eb503e42fd581528c593f5a343aed5a1a7bf4233 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Mon, 6 Jul 2015 18:12:25 +0200 Subject: [PATCH 3/5] Fix variable name --- lib/vagrant-lxc/action/gc_private_network_bridges.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/action/gc_private_network_bridges.rb b/lib/vagrant-lxc/action/gc_private_network_bridges.rb index c6d358e..946283e 100644 --- a/lib/vagrant-lxc/action/gc_private_network_bridges.rb +++ b/lib/vagrant-lxc/action/gc_private_network_bridges.rb @@ -35,7 +35,7 @@ module Vagrant if ! driver.bridge_is_in_use?(bridge) env[:ui].info I18n.t("vagrant_lxc.messages.remove_bridge", name: bridge) - if bridge_name != "lxcbr0" + if bridge != "lxcbr0" driver.remove_bridge(bridge) end end From 40ced9d3d1d803666d90b49cdad5c27137d326b5 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Tue, 25 Aug 2015 14:36:59 +0200 Subject: [PATCH 4/5] Do not remove system bridge virbr0 --- lib/vagrant-lxc/action/gc_private_network_bridges.rb | 4 ++-- lib/vagrant-lxc/driver.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-lxc/action/gc_private_network_bridges.rb b/lib/vagrant-lxc/action/gc_private_network_bridges.rb index 946283e..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,8 @@ module Vagrant if ! driver.bridge_is_in_use?(bridge) env[:ui].info I18n.t("vagrant_lxc.messages.remove_bridge", name: bridge) - if bridge != "lxcbr0" - driver.remove_bridge(bridge) + unless ['lxcbr0', 'virbr0'].include? bridge + driver.remove_bridge(bridge) end end end diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 1f54377..66616f5 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -172,7 +172,7 @@ module Vagrant end def remove_bridge(bridge_name) - if bridge_name == "lxcbr0" + if ['lxcbr0', 'virbr0'].include? bridge_name @logger.info "Skipping removal system bridge #{bridge_name}" return end From 366a98a0527d6d6e89b80843bad17cf3040fd9c3 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Tue, 25 Aug 2015 14:37:31 +0200 Subject: [PATCH 5/5] Fix warning message --- lib/vagrant-lxc/driver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 66616f5..4b31c93 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -173,7 +173,7 @@ module Vagrant def remove_bridge(bridge_name) if ['lxcbr0', 'virbr0'].include? bridge_name - @logger.info "Skipping removal system bridge #{bridge_name}" + @logger.info "Skipping removal of system bridge #{bridge_name}" return end