summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-05-14 14:00:50 +0200
committerDamjan Marion <dmarion@me.com>2021-05-21 21:07:38 +0000
commitd640ae52f6d0903e8921f8b259bac3431f9cce4b (patch)
treee4fb910241c4bd9acd0d6ec262615566c8bfec0b /src/vpp-api/python/vpp_papi
parent1a06e53341224bb08cff2fb6d218415c50f947d3 (diff)
stats: catch stat segment overrun in retry loop
Raise IOError so that the blocking code retries not only on optimistic locking failures but also on data segment illegal reads. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I6bb250e239486b60192004271c1690e790513318
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rwxr-xr-xsrc/vpp-api/python/vpp_papi/vpp_stats.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index 821a4131834..884a30019f8 100755
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -69,7 +69,7 @@ def get_string(stats, ptr):
namevector = ptr - stats.base
namevectorlen = get_vec_len(stats, namevector)
if namevector + namevectorlen >= stats.size:
- raise ValueError('String overruns stats segment')
+ raise IOError('String overruns stats segment')
return stats.statseg[namevector:namevector+namevectorlen-1].decode('ascii')
@@ -86,7 +86,7 @@ class StatsVector:
self.stats = stats
if self.vec_start + self.vec_len * self.elementsize >= stats.size:
- raise ValueError('Vector overruns stats segment')
+ raise IOError('Vector overruns stats segment')
def __iter__(self):
with self.stats.lock:
@@ -95,7 +95,7 @@ class StatsVector:
def __getitem__(self, index):
if index > self.vec_len:
- raise ValueError('Index beyond end of vector')
+ raise IOError('Index beyond end of vector')
with self.stats.lock:
if self.fmtlen == 1:
return self.struct.unpack_from(self.statseg, self.vec_start +