]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
dashboard: Return float if rate not available
authorBoris Ranto <branto@redhat.com>
Tue, 29 May 2018 21:32:48 +0000 (23:32 +0200)
committerBoris Ranto <branto@redhat.com>
Thu, 31 May 2018 08:02:41 +0000 (10:02 +0200)
This fixes a test case issue when some of the data might not be
available during the test, yet. The test expects the second value to be
JFloat but that fails because get_rates return an int in that case.

Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit 58ffd146261586b5598c946fd730df0b223294e7)

src/pybind/mgr/dashboard/services/ceph_service.py

index 6e91165a3b9134068d4b03962940cb2a79de722b..4925f806c945a7331da581a35fd1fe43a7f91a22 100644 (file)
@@ -167,9 +167,9 @@ class CephService(object):
         :rtype: list[tuple[int, float]]"""
         data = mgr.get_counter(svc_type, svc_name, path)[path]
         if not data:
-            return [(0, 0)]
+            return [(0, 0.0)]
         elif len(data) == 1:
-            return [(data[0][0], 0)]
+            return [(data[0][0], 0.0)]
         return [(data2[0], differentiate(data1, data2)) for data1, data2 in pairwise(data)]
 
     @classmethod