summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2017-08-27 19:37:43 -0400
committerTim Rozet <trozet@redhat.com>2017-08-27 19:37:43 -0400
commit2af337a7d3a26a034a94f3698b1b1b3512d2c135 (patch)
tree24a85b2ebeae14cc341771b23881801dbcf24d5d
parent583ae93f658e84a349638aeb33209aaae6cad63f (diff)
Fixes bridge checking on jumphost for bm
Change-Id: I5e90dd84383c7348d2cbe58a18370ca10d915598 Signed-off-by: Tim Rozet <trozet@redhat.com>
-rw-r--r--apex/network/jumphost.py11
1 files changed, 11 insertions, 0 deletions
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
@@ -88,6 +88,17 @@ def attach_interface_to_ovs(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)
if interface in output.decode('utf-8'):