From 0164c399f3c22edce6488cd28e5b172b68ca1239 Mon Sep 17 00:00:00 2001 From: simon gao Date: Sun, 30 Jun 2019 04:09:18 -0400 Subject: [PATCH] mgr/status: fix 'ceph osd status' ZeroDivisionError Signed-off-by: simon gao --- src/pybind/mgr/status/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/status/module.py b/src/pybind/mgr/status/module.py index bd0faa34292..76230313c97 100644 --- a/src/pybind/mgr/status/module.py +++ b/src/pybind/mgr/status/module.py @@ -43,7 +43,7 @@ class Module(MgrModule): data = self.get_counter(daemon_type, daemon_name, stat)[stat] #self.log.error("get_latest {0} data={1}".format(stat, data)) - if data and len(data) > 1: + if data and len(data) > 1 and data[-1][0] != data[-2][0]: return (data[-1][1] - data[-2][1]) / float(data[-1][0] - data[-2][0]) else: return 0 -- 2.47.3