From fd40f76366e1877f6e205101647ad5b847b47fe6 Mon Sep 17 00:00:00 2001 From: Neeraj Pratap Singh Date: Wed, 23 Nov 2022 17:31:33 +0530 Subject: [PATCH] cephfs-top: sorting excepts when the filesystems are removed and created Fixes: https://tracker.ceph.com/issues/58031 Signed-off-by: Neeraj Pratap Singh --- src/tools/cephfs/top/cephfs-top | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 0920f12b0de9b..096be4769c132 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -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: -- 2.39.5