]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/status: cast return value to int
authorKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 03:42:05 +0000 (11:42 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 11:42:32 +0000 (19:42 +0800)
the return value of get_rate() is fed to mgr_util.format_dimless(),
which always cast the formatted value to int.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/status/module.py

index b45aa876a05dc980e8e514227137dc3a93bc1874..3ef39c20f805d01921302292bc76a126e8ab9ac9 100644 (file)
@@ -29,7 +29,7 @@ class Module(MgrModule):
 
         #self.log.error("get_latest {0} data={1}".format(stat, data))
         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])
+            return (data[-1][1] - data[-2][1]) // int(data[-1][0] - data[-2][0])
         else:
             return 0