Skip to contentSkip to conversation

mountstats: Adding 'Day, Hour:Min:Sec' to "mountstats --nfs" for ease of understanding.

PATCH In review Rohan Sable 2 participants 2 messages Jun 5, 2020 – Jun 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mountstats: Adding 'Day, Hour:Min:Sec' to "mountstats --nfs" for ease of understanding.

This patch adds printing of 'Days, Hours:Mins:Sec' like below to --nfs in mountstats :
NFS mount age : 12 days, 23:59:59

---
 tools/mountstats/mountstats.py | 2 ++
 1 file changed, 2 insertions(+)
tools/mountstats/mountstats.py +2 -0
index d565385d..014f38a3 100755
@@ -4,6 +4,7 @@
 """
 
 from __future__ import print_function
+import datetime as datetime
 
 __copyright__ = """
 Copyright (C) 2005, Chuck Lever <[email protected]>
@@ -391,6 +392,7 @@ class DeviceData:
         """Pretty-print the NFS options
         """
         print('  NFS mount options: %s' % ','.join(self.__nfs_data['mountoptions']))
+        print('  NFS mount age: %s' % datetime.timedelta(seconds = self.__nfs_data['age']))
         print('  NFS server capabilities: %s' % ','.join(self.__nfs_data['servercapabilities']))
         if 'nfsv4flags' in self.__nfs_data:
             print('  NFSv4 capability flags: %s' % ','.join(self.__nfs_data['nfsv4flags']))
Signature · 1 line
2.25.4
#1 lore raw
Quoted 4 lines · Rohan Sable

This patch adds printing of 'Days, Hours:Mins:Sec' like below to --nfs in mountstats :
NFS mount age : 12 days, 23:59:59

Committed....

steved.

Quoted 25 lines
---
 tools/mountstats/mountstats.py | 2 ++
 1 file changed, 2 insertions(+)
tools/mountstats/mountstats.py +2 -0
index d565385d..014f38a3 100755
@@ -4,6 +4,7 @@
 """
 
 from __future__ import print_function
+import datetime as datetime
 
 __copyright__ = """
 Copyright (C) 2005, Chuck Lever <[email protected]>
@@ -391,6 +392,7 @@ class DeviceData:
         """Pretty-print the NFS options
         """
         print('  NFS mount options: %s' % ','.join(self.__nfs_data['mountoptions']))
+        print('  NFS mount age: %s' % datetime.timedelta(seconds = self.__nfs_data['age']))
         print('  NFS server capabilities: %s' % ','.join(self.__nfs_data['servercapabilities']))
         if 'nfsv4flags' in self.__nfs_data:
             print('  NFSv4 capability flags: %s' % ','.join(self.__nfs_data['nfsv4flags']))