]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: sorting excepts when the filesystems are removed and created
authorNeeraj Pratap Singh <neesingh@redhat.com>
Wed, 23 Nov 2022 12:01:33 +0000 (17:31 +0530)
committerNeeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
Fri, 17 Feb 2023 16:38:16 +0000 (22:08 +0530)
Fixes: https://tracker.ceph.com/issues/58031
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
(cherry picked from commit fd40f76366e1877f6e205101647ad5b847b47fe6)

src/tools/cephfs/top/cephfs-top

index 60350868869888ef9d1f0e5236e7e7e7b04f457c..da19cb09c517e57b4deacd17bfc62939b0a8df77 100755 (executable)
@@ -773,7 +773,8 @@ class FSTop(object):
             else:
                 sort_arg = current_states['last_field']
                 sort_list = sorted(list(stats_json[GLOBAL_METRICS_KEY].get(fs_name, {}).keys()),
-                                   key=lambda x: metrics_dict[fs_name][x][sort_arg], reverse=True)
+                                   key=lambda x: metrics_dict[fs_name].get(x, {}).get(sort_arg, 0),
+                                   reverse=True)
             if current_states['limit'] is not None and int(current_states['limit']) < client_cnt:
                 sort_list = sort_list[0:int(current_states['limit'])]
             for client_id in sort_list: