mountstats fixes
The previous commit for RHEL-90242 didn't contain the complete set of mountstats fixes. Resolves: RHEL-90242 Signed-off-by: Scott Mayhew <smayhew@redhat.com>
This commit is contained in:
parent
6c13c037b5
commit
7e11b6928c
141
nfs-utils-2.3.3-mountstats-fixes.patch
Normal file
141
nfs-utils-2.3.3-mountstats-fixes.patch
Normal file
@ -0,0 +1,141 @@
|
||||
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
|
||||
index 8e129c83..d488f9e1 100755
|
||||
--- a/tools/mountstats/mountstats.py
|
||||
+++ b/tools/mountstats/mountstats.py
|
||||
@@ -333,6 +333,11 @@ class DeviceData:
|
||||
found = True
|
||||
self.__parse_rpc_line(words)
|
||||
|
||||
+ def fstype(self):
|
||||
+ """Return the fstype for the mountpoint
|
||||
+ """
|
||||
+ return self.__nfs_data['fstype']
|
||||
+
|
||||
def is_nfs_mountpoint(self):
|
||||
"""Return True if this is an NFS or NFSv4 mountpoint,
|
||||
otherwise return False
|
||||
@@ -953,73 +958,78 @@ def nfsstat_command(args):
|
||||
return 0
|
||||
|
||||
def print_iostat_summary(old, new, devices, time):
|
||||
+ if len(devices) == 0:
|
||||
+ print('No NFS mount points were found')
|
||||
+ return
|
||||
+
|
||||
for device in devices:
|
||||
stats = DeviceData()
|
||||
stats.parse_stats(new[device])
|
||||
- if not old or device not in old:
|
||||
+ if old and device in old:
|
||||
+ old_stats = DeviceData()
|
||||
+ old_stats.parse_stats(old[device])
|
||||
+ if stats.fstype() == old_stats.fstype():
|
||||
+ stats.compare_iostats(old_stats).display_iostats(time)
|
||||
+ else: # device is in old, but fstypes are different
|
||||
+ stats.display_iostats(time)
|
||||
+ else: # device is only in new
|
||||
stats.display_iostats(time)
|
||||
- else:
|
||||
- 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 list_nfs_mounts(givenlist, mountstats):
|
||||
+ """return a list of NFS mounts given a list to validate or
|
||||
+ return a full list if the given list is empty -
|
||||
+ may return an empty list if none found
|
||||
+ """
|
||||
+ devicelist = []
|
||||
+ if len(givenlist) > 0:
|
||||
+ for device in givenlist:
|
||||
+ if device in mountstats:
|
||||
+ stats = DeviceData()
|
||||
+ stats.parse_stats(mountstats[device])
|
||||
+ if stats.is_nfs_mountpoint():
|
||||
+ devicelist += [device]
|
||||
+ else:
|
||||
+ for device, descr in mountstats.items():
|
||||
+ stats = DeviceData()
|
||||
+ stats.parse_stats(descr)
|
||||
+ if stats.is_nfs_mountpoint():
|
||||
+ devicelist += [device]
|
||||
+ return devicelist
|
||||
|
||||
def iostat_command(args):
|
||||
"""iostat-like command for NFS mount points
|
||||
"""
|
||||
mountstats = parse_stats_file(args.infile)
|
||||
- devices = [os.path.normpath(mp) for mp in args.mountpoints]
|
||||
+ origdevices = [os.path.normpath(mp) for mp in args.mountpoints]
|
||||
|
||||
if args.since:
|
||||
old_mountstats = parse_stats_file(args.since)
|
||||
else:
|
||||
old_mountstats = None
|
||||
|
||||
- # make certain devices contains only NFS mount points
|
||||
- if len(devices) > 0:
|
||||
- check = []
|
||||
- for device in devices:
|
||||
- stats = DeviceData()
|
||||
- try:
|
||||
- stats.parse_stats(mountstats[device])
|
||||
- if stats.is_nfs_mountpoint():
|
||||
- check += [device]
|
||||
- except KeyError:
|
||||
- continue
|
||||
- devices = check
|
||||
- else:
|
||||
- for device, descr in mountstats.items():
|
||||
- stats = DeviceData()
|
||||
- stats.parse_stats(descr)
|
||||
- if stats.is_nfs_mountpoint():
|
||||
- devices += [device]
|
||||
- if len(devices) == 0:
|
||||
- print('No NFS mount points were found')
|
||||
- return 1
|
||||
-
|
||||
sample_time = 0
|
||||
|
||||
+ # make certain devices contains only NFS mount points
|
||||
+ devices = list_nfs_mounts(origdevices, mountstats)
|
||||
+ print_iostat_summary(old_mountstats, mountstats, devices, sample_time)
|
||||
+
|
||||
if args.interval is None:
|
||||
- print_iostat_summary(old_mountstats, mountstats, devices, sample_time)
|
||||
return
|
||||
|
||||
- if args.count is not None:
|
||||
- count = args.count
|
||||
- while count != 0:
|
||||
- print_iostat_summary(old_mountstats, mountstats, devices, sample_time)
|
||||
- old_mountstats = mountstats
|
||||
- time.sleep(args.interval)
|
||||
- sample_time = args.interval
|
||||
- mountstats = parse_stats_file(args.infile)
|
||||
+ count = args.count
|
||||
+ while True:
|
||||
+ if count is not None:
|
||||
count -= 1
|
||||
- else:
|
||||
- while True:
|
||||
- print_iostat_summary(old_mountstats, mountstats, devices, sample_time)
|
||||
- old_mountstats = mountstats
|
||||
- time.sleep(args.interval)
|
||||
- sample_time = args.interval
|
||||
- mountstats = parse_stats_file(args.infile)
|
||||
+ if count == 0:
|
||||
+ break
|
||||
+ time.sleep(args.interval)
|
||||
+ old_mountstats = mountstats
|
||||
+ sample_time = args.interval
|
||||
+ mountstats = parse_stats_file(args.infile)
|
||||
+ # nfs mountpoints may appear or disappear, so we need to
|
||||
+ # recheck the devices list each time we parse mountstats
|
||||
+ devices = list_nfs_mounts(origdevices, mountstats)
|
||||
+ print_iostat_summary(old_mountstats, mountstats, devices, sample_time)
|
||||
|
||||
args.infile.close()
|
||||
if args.since:
|
||||
@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
|
||||
Name: nfs-utils
|
||||
URL: http://linux-nfs.org/
|
||||
Version: 2.3.3
|
||||
Release: 62%{?dist}
|
||||
Release: 63%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
# group all 32bit related archs
|
||||
@ -116,6 +116,7 @@ Patch058: nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch
|
||||
Patch059: nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch
|
||||
Patch060: nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch
|
||||
Patch061: nfs-utils-2.3.3-nfsiostat-fixes.patch
|
||||
Patch062: nfs-utils-2.3.3-mountstats-fixes.patch
|
||||
|
||||
Patch100: nfs-utils-1.2.1-statdpath-man.patch
|
||||
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
|
||||
@ -394,6 +395,9 @@ fi
|
||||
%{_libdir}/libnfsidmap.so
|
||||
|
||||
%changelog
|
||||
* Fri May 9 2025 Scott Mayhew <smayhew@redhat.com> 2.3.3-63
|
||||
- mountstats fixes (RHEL-90242)
|
||||
|
||||
* Thu May 8 2025 Scott Mayhew <smayhew@redhat.com> 2.3.3-62
|
||||
- nfsiostat fixes (RHEL-90242)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user