From: simon gao Date: Sun, 30 Jun 2019 08:09:18 +0000 (-0400) Subject: mgr/status: fix 'ceph osd status' ZeroDivisionError X-Git-Tag: v15.1.0~2240^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0164c399f3c22edce6488cd28e5b172b68ca1239;p=ceph-ci.git mgr/status: fix 'ceph osd status' ZeroDivisionError Signed-off-by: simon gao --- 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