]> 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>
Tue, 14 Feb 2023 05:04:25 +0000 (10:34 +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 ceccb8546d0916478cc0bcdea1c59f73037eb673..6059ea9b18adba900ab9b4ea8ae3a6a67ff5d3fa 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: