Skip to content

Commit

Permalink
Issue LarkIT#6 - ReadDirPlus doesn't work on NFSv4 mounts
Browse files Browse the repository at this point in the history
This adds ReadDirPlus back in for NFSv3 mounts, but has an exception
similar to the code used in nfsiostat. I had to expose another method
in nfsiostat.py has_readdirplus() since that was internal only data before.

~tommy
  • Loading branch information
Tommy McNeely committed Nov 5, 2014
1 parent b11c9b2 commit fc55405
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/nfsiostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ def backlog(self, sample_time):
return (float(self.__rpc_data['backlogutil']) / sends) / sample_time
else:
return 0.0
def has_readdirplus(self):
return self.__rpc_data.has_key('READDIRPLUS')

def display_iostats(self, sample_time, which):
"""Display NFS and RPC stats in an iostat-like way
Expand Down
5 changes: 4 additions & 1 deletion src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _parse_config(self):
self.logger.info("Configured to use proxy: %s:%s" % (proxy_host, proxy_port))
# Initialize NFS related values
self.nfs_device_list = json.loads(config.get('nfs','device_list'))
self.nfs_ops = ['Read','Write','GetAttr','Access','Lookup','ReadDir']
self.nfs_ops = ['Read','Write','GetAttr','Access','Lookup','ReadDir','ReadDirPlus']

except Exception, e:
self.logger.exception(e)
Expand Down Expand Up @@ -182,6 +182,9 @@ def _get_nfs_stat_for(self, volume, prefix='Component/NFS/Volume'):
}

for op in (self.nfs_ops):
if op.upper() is 'READDIRPLUS' and not volnfsstat.has_readdirplus():
# NFSv4 mounts do not have READDIRPLUS
continue
op_stat = volnfsstat.get_rpc_op_stats(op.upper(), self.duration)
op_prefix = prefix + op
op_data = {
Expand Down

0 comments on commit fc55405

Please sign in to comment.