From 8a13592b16f5ec4c3c01226fd7926b8dce257f27 Mon Sep 17 00:00:00 2001 From: Neeraj Pratap Singh Date: Tue, 21 Feb 2023 18:21:55 +0530 Subject: [PATCH 1/2] cephfs-top: display_menu() isn't triggered when all fs' are removed Fixes: https://tracker.ceph.com/issues/58813 Signed-off-by: Neeraj Pratap Singh --- src/tools/cephfs/top/cephfs-top | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 5461b9d7595..e13f08074d9 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -445,13 +445,14 @@ class FSTop(FSTopBase): key = 0 endwhile = False while not endwhile: - global current_states + global current_states, fs_list + fs_list = self.get_fs_names() if key == curses.KEY_UP and curr_row1 > 0: curr_row1 -= 1 elif key == curses.KEY_DOWN and curr_row1 < len(field_menu) - 1: curr_row1 += 1 - elif key == curses.KEY_ENTER or key in [10, 13]: + elif (key in [curses.KEY_ENTER, 10, 13]) and fs_list: self.stdscr.erase() if curr_row1 != len(field_menu) - 1: current_states["last_field"] = (field_menu[curr_row1].split('='))[0] From db48c819bb28bd900df031a39ad687e7dc8ce6a5 Mon Sep 17 00:00:00 2001 From: Neeraj Pratap Singh Date: Tue, 21 Feb 2023 18:26:37 +0530 Subject: [PATCH 2/2] cephfs-top: navigate to home screen while selecting sort field, if no filesystems. Fixes: https://tracker.ceph.com/issues/58813 Signed-off-by: Neeraj Pratap Singh --- src/tools/cephfs/top/cephfs-top | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index e13f08074d9..152dfe9e7f6 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -466,10 +466,10 @@ class FSTop(FSTopBase): endwhile = True elif key == ord('q'): self.stdscr.erase() - if self.active_screen == FS_TOP_ALL_FS_APP: - self.run_all_display() - else: + if fs_list and self.active_screen == FS_TOP_FS_SELECTED_APP: self.run_display() + else: + self.run_all_display() endwhile = True try: