From: Tim Rozet Date: Sun, 27 Aug 2017 23:37:43 +0000 (-0400) Subject: Fixes bridge checking on jumphost for bm X-Git-Tag: opnfv-5.0.0~82 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=2af337a7d3a26a034a94f3698b1b1b3512d2c135;p=apex.git Fixes bridge checking on jumphost for bm Change-Id: I5e90dd84383c7348d2cbe58a18370ca10d915598 Signed-off-by: Tim Rozet --- 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)