From: Neeraj Pratap Singh Date: Wed, 23 Nov 2022 12:01:33 +0000 (+0530) Subject: cephfs-top: sorting excepts when the filesystems are removed and created X-Git-Tag: v18.1.0~828^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F49026%2Fhead;p=ceph.git cephfs-top: sorting excepts when the filesystems are removed and created Fixes: https://tracker.ceph.com/issues/58031 Signed-off-by: Neeraj Pratap Singh --- diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 0920f12b0de..096be4769c1 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: