]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: sorting excepts when the filesystems are removed and created 49026/head
authorNeeraj Pratap Singh <neesingh@redhat.com>
Wed, 23 Nov 2022 12:01:33 +0000 (17:31 +0530)
committerNeeraj Pratap Singh <neesingh@redhat.com>
Thu, 24 Nov 2022 05:19:26 +0000 (10:49 +0530)
Fixes: https://tracker.ceph.com/issues/58031
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
src/tools/cephfs/top/cephfs-top

index 0920f12b0de9bfbad3d0ece5eddb5b8912990790..096be4769c13276056eba82299b74396b9f8a4b6 100755 (executable)
@@ -771,7 +771,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: