From 2bfbe25b1df24d562789faa641c41e9cafec7efa Mon Sep 17 00:00:00 2001 From: Nikolas Hermanns Date: Thu, 6 Apr 2017 15:54:59 +0200 Subject: Checking if hacked quagga bridge exsists and contiune Change-Id: I8983ed687dabba0af2128c0ce06bd53aba22c819 Signed-off-by: Nikolas Hermanns --- sdnvpn/lib/utils.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py index eb59446..03fea54 100644 --- a/sdnvpn/lib/utils.py +++ b/sdnvpn/lib/utils.py @@ -488,13 +488,15 @@ def attach_instance_to_ext_br(instance, compute_node): bridge = "br-quagga" cmd = """ set -xe - sudo brctl addbr {bridge} && - sudo ip link set {bridge} up && - sudo ip link add quagga-tap type veth peer name ovs-quagga-tap && - sudo ip link set dev ovs-quagga-tap up && - sudo ip link set dev quagga-tap up && - sudo ovs-vsctl add-port br-ex ovs-quagga-tap && - sudo brctl addif {bridge} quagga-tap + if ! brctl show |grep -q ^br-quagga;then + sudo brctl addbr {bridge} && + sudo ip link set {bridge} up && + sudo ip link add quagga-tap type veth peer name ovs-quagga-tap && + sudo ip link set dev ovs-quagga-tap up && + sudo ip link set dev quagga-tap up && + sudo ovs-vsctl add-port br-ex ovs-quagga-tap && + sudo brctl addif {bridge} quagga-tap + fi """ compute_node.run_cmd(cmd.format(bridge=bridge)) -- cgit 1.2.3-korg