]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mountstats: Breaks on 3.1 kernels nfs-utils-1-2-5-rc3
authorSteve Dickson <steved@redhat.com>
Wed, 21 Sep 2011 18:05:07 +0000 (14:05 -0400)
committerSteve Dickson <steved@redhat.com>
Wed, 21 Sep 2011 19:41:59 +0000 (15:41 -0400)
mountstats depend on all devices entries in /proc/self/mountstats
to start with the word 'device'. With 3.1 kernels, NFS entries
start with the actual device (i.e. server:/export) not
the word 'device'. This change confused mountstats parsing.

Signed-off-by: Steve Dickson <steved@redhat.com>
tools/mountstats/mountstats.py

index 280e15ca3b102e8e25804de8a2de208fdfa4d593..b95b71d27ef3f43ff9d47bac3753e6b82ad08e90 100644 (file)
@@ -46,6 +46,12 @@ class DeviceData:
             self.__nfs_data['fstype'] = words[7]
             if words[7].find('nfs') != -1:
                 self.__nfs_data['statvers'] = words[8]
             self.__nfs_data['fstype'] = words[7]
             if words[7].find('nfs') != -1:
                 self.__nfs_data['statvers'] = words[8]
+        elif 'nfs' in words or 'nfs4' in words:
+            self.__nfs_data['export'] = words[0]
+            self.__nfs_data['mountpoint'] = words[3]
+            self.__nfs_data['fstype'] = words[6]
+            if words[6].find('nfs') != -1:
+                self.__nfs_data['statvers'] = words[7]
         elif words[0] == 'age:':
             self.__nfs_data['age'] = long(words[1])
         elif words[0] == 'opts:':
         elif words[0] == 'age:':
             self.__nfs_data['age'] = long(words[1])
         elif words[0] == 'opts:':
@@ -371,6 +377,9 @@ def parse_stats_file(filename):
         if words[0] == 'device':
             key = words[4]
             new = [ line.strip() ]
         if words[0] == 'device':
             key = words[4]
             new = [ line.strip() ]
+        elif 'nfs' in words or 'nfs4' in words:
+            key = words[3]
+            new = [ line.strip() ]
         else:
             new += [ line.strip() ]
         ms_dict[key] = new
         else:
             new += [ line.strip() ]
         ms_dict[key] = new