From 2af337a7d3a26a034a94f3698b1b1b3512d2c135 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Sun, 27 Aug 2017 19:37:43 -0400 Subject: Fixes bridge checking on jumphost for bm Change-Id: I5e90dd84383c7348d2cbe58a18370ca10d915598 Signed-off-by: Tim Rozet --- apex/network/jumphost.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apex/network/jumphost.py b/apex/network/jumphost.py index 1afcea72..f3f06ad6 100644 --- a/apex/network/jumphost.py +++ b/apex/network/jumphost.py @@ -87,6 +87,17 @@ def attach_interface_to_ovs(bridge, interface, network): bridge, interface, network )) + try: + output = subprocess.check_output(['ovs-vsctl', 'show'], + stderr=subprocess.STDOUT) + if bridge not in output.decode('utf-8'): + logging.debug("Bridge {} not found. Creating...".format(bridge)) + subprocess.check_call(['ovs-vsctl', 'add-br', bridge]) + else: + logging.debug("Bridge {} found".format(bridge)) + except subprocess.CalledProcessError: + logging.error("Unable to validate/create OVS bridge {}".format(bridge)) + raise try: output = subprocess.check_output(['ovs-vsctl', 'list-ports', bridge], stderr=subprocess.STDOUT) -- cgit 1.2.3-korg