summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-06-04 12:33:32 +0200
committerNeale Ranns <nranns@cisco.com>2019-06-04 11:32:52 +0000
commitc424de75e561b2197d29812b3900db58a06096d7 (patch)
tree39618235deba5f5421012c611986f761f3a8de1e
parentb538dd868665009f9a3737610177342f88e3ba80 (diff)
stats: removing empty object in stats vector
Type: fix Change-Id: I9b6bdacdb9a0750834de9a93d8c3f7ed827ce3c8 Signed-off-by: Ole Troan <ot@cisco.com>
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_stats.py4
-rw-r--r--src/vpp/stats/stat_segment.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index 86a80ddc328..76ccf1042f6 100644
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -199,7 +199,9 @@ class VPPStats(object):
while time.time() < poll_end_time:
rv = self.api.stat_segment_connect_r(socketname.encode('utf-8'),
self.client)
- if rv == 0:
+ # Break out if success or any other error than "no such file"
+ # (indicating that VPP hasn't started yet)
+ if rv == 0 or ffi.errno != 2:
break
if rv != 0:
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index a5529b993d3..3007889b666 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -285,7 +285,7 @@ vlib_map_stat_segment_init (void)
shared_header->epoch = 1;
/* Scalar stats and node counters */
- vec_validate (sm->directory_vector, STAT_COUNTERS);
+ vec_validate (sm->directory_vector, STAT_COUNTERS - 1);
#define _(E,t,n,p) \
strcpy(sm->directory_vector[STAT_COUNTER_##E].name, #p "/" #n); \
sm->directory_vector[STAT_COUNTER_##E].type = STAT_DIR_TYPE_##t;