summaryrefslogtreecommitdiff
path: root/tools/mountstats
diff options
context:
space:
mode:
authorKenneth D'souza <kdsouza@redhat.com>2020-09-08 10:07:04 -0400
committerSteve Dickson <steved@redhat.com>2020-09-08 10:07:04 -0400
commit4585114420ab5fabf530f3c812ce4741f02d8cd5 (patch)
tree260f0d1e1fb7816694d7f4629d33644c0fdbd91b /tools/mountstats
parent086e6fdce887dd68e51b7bac4a2f21cea9a4fe01 (diff)
downloadnfs-utils-4585114420ab5fabf530f3c812ce4741f02d8cd5.tar.gz
nfsiostat/mountstats: Drop autofs entries before calling compare_iostats()
nfsiostat/mountstats can fail with below KeyError when old stat and new stat data go out of sync. $ mountstats iostat 1 3 Traceback (most recent call last): File "/usr/sbin/mountstats", line 1092, in <module> res = main() File "/usr/sbin/mountstats", line 1081, in main return args.func(args) File "/usr/sbin/mountstats", line 965, in iostat_command print_iostat_summary(old_mountstats, mountstats, devices, sample_time) File "/usr/sbin/mountstats", line 920, in print_iostat_summary diff_stats = stats.compare_iostats(old_stats) File "/usr/sbin/mountstats", line 528, in compare_iostats if old_stats.__nfs_data['age'] > self.__nfs_data['age']: KeyError: 'age' Frequent mount and umount can cause autofs entries to be processed in compare_iostats. We need to filter the devices list and drop autofs entries to fix the issue. This way we pass only nfs mounts and not autofs entries. Signed-off-by: Kenneth D'souza <kdsouza@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'tools/mountstats')
-rwxr-xr-xtools/mountstats/mountstats.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 00adc96..25e92a1 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -953,10 +953,11 @@ def print_iostat_summary(old, new, devices, time):
if not old or device not in old:
stats.display_iostats(time)
else:
- old_stats = DeviceData()
- old_stats.parse_stats(old[device])
- diff_stats = stats.compare_iostats(old_stats)
- diff_stats.display_iostats(time)
+ if ("fstype autofs" not in str(old[device])) and ("fstype autofs" not in str(new[device])):
+ old_stats = DeviceData()
+ old_stats.parse_stats(old[device])
+ diff_stats = stats.compare_iostats(old_stats)
+ diff_stats.display_iostats(time)
def iostat_command(args):
"""iostat-like command for NFS mount points