]> 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)
committerNitzanMordhai <nmordech@redhat.com>
Sun, 19 Nov 2023 10:57:40 +0000 (10:57 +0000)
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>
(cherry picked from commit f1ebf6b34d31b732956178eef608d324d50aa7c2)

src/pybind/mgr/status/module.py

index 4cd8c2c714f0f3b7d31cc3d28dfb97fd6f8b0276..676bc03d9a01f1bb6f5f818c3faa62c37529b2df 100644 (file)
@@ -44,7 +44,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