aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2018-02-08 12:33:17 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2018-02-08 12:33:17 +0000
commit7b1aa398a2ec20a84525a2a36dc0f8e3f2186dfb (patch)
tree494775764a5f856b30bd8a9fd3f6ee7740401d30
parent488b9f9584096901c4f2f97352c82f05d7b9607e (diff)
Add debug and retries around vlan_get_name()
We've noticed this fail in testing, so let's see what's going on. Change-Id: I08785ef2161edc57c84890945c6e3f1670880f51
-rw-r--r--drivers/Mellanox.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/Mellanox.py b/drivers/Mellanox.py
index dbdd104..ea74bf0 100644
--- a/drivers/Mellanox.py
+++ b/drivers/Mellanox.py
@@ -142,8 +142,19 @@ class Mellanox(SwitchDriver):
self._cli("vlan %d name %s" % (tag, name))
self._end_configure()
- # Validate it happened
- read_name = self.vlan_get_name(tag)
+ # This switch *might* have problems if we drive it too quickly? At
+ # least one instance of set_name()/get_name() not working. This
+ # might help?
+ self._delay()
+
+ # And retry around here
+ retries = 5
+ read_name = None
+ while (retries > 0 and read_name is None):
+ # Validate it happened
+ read_name = self.vlan_get_name(tag)
+ retries -= 1
+
if read_name != name:
raise IOError("Failed to set name for VLAN %d (name found is \"%s\", not \"%s\")"
% (tag, read_name, name))
@@ -206,6 +217,8 @@ class Mellanox(SwitchDriver):
match = regex.match(line)
if match:
name = re.sub(r'Eth.*$',"",match.group(1)).strip()
+ if name is None:
+ logging.debug("vlan_get_name: did not find a name")
return name
except PExpectError: