]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: fixing the -d [--delay] option in cephfs-top
authorNeeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
Tue, 28 Mar 2023 10:26:24 +0000 (15:56 +0530)
committerneeraj pratap singh <neerajpratapsingh@li-ff7f0d4c-3462-11b2-a85c-d4004c0fa1a0.ibm.com>
Tue, 4 Apr 2023 10:55:36 +0000 (16:25 +0530)
Fixes: https://tracker.ceph.com/issues/59188
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
src/tools/cephfs/top/cephfs-top

index b4b757de98820807fe007b5a9e5b3a43a95f1cbe..f827664c90f32659c3584983ad7a06296d9ec9f6 100755 (executable)
@@ -45,8 +45,6 @@ FS_TOP_SUPPORTED_VER = 2
 ITEMS_PAD_LEN = 3
 ITEMS_PAD = " " * ITEMS_PAD_LEN
 DEFAULT_REFRESH_INTERVAL = 1
-# min refresh interval allowed
-MIN_REFRESH_INTERVAL = 0.5
 
 # metadata provided by mgr/stats
 FS_TOP_MAIN_WINDOW_COL_CLIENT_ID = "client_id"
@@ -1185,14 +1183,6 @@ class FSTop(FSTopBase):
 
 
 if __name__ == '__main__':
-    def float_greater_than(x):
-        value = float(x)
-        if value < MIN_REFRESH_INTERVAL:
-            raise argparse.ArgumentTypeError(
-                'Refresh interval should be greater than or equal to'
-                f' {MIN_REFRESH_INTERVAL}')
-        return value
-
     parser = argparse.ArgumentParser(description='Ceph Filesystem top utility')
     parser.add_argument('--cluster', nargs='?', const='ceph', default='ceph',
                         help='Ceph cluster to connect (default: ceph)')
@@ -1202,9 +1192,9 @@ if __name__ == '__main__':
                         help='Path to cluster configuration file')
     parser.add_argument('--selftest', dest='selftest', action='store_true',
                         help='Run in selftest mode')
-    parser.add_argument('-d', '--delay', nargs='?',
+    parser.add_argument('-d', '--delay', dest='delay', choices=range(1, 26),
                         default=DEFAULT_REFRESH_INTERVAL,
-                        type=float_greater_than,
+                        type=int,
                         help='Refresh interval in seconds '
                         f'(default: {DEFAULT_REFRESH_INTERVAL})')
     parser.add_argument('--dump', dest='dump', action='store_true',