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: v17.2.6~56^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dd6ad96834e31fc4ef8c3fb33a40efd44e50f86f;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 (cherry picked from commit fd40f76366e1877f6e205101647ad5b847b47fe6) --- diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 60350868869..da19cb09c51 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -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: