2017-09-22 20:30:10

by Manjunath Patil

[permalink] [raw]
Subject: [PATCH] nfsiostat: avoid parsing "no device mounted ..." line

Present nfsiostat includes the "no device mounted ..." line from
/proc/self/mountstats as addition description of the preceding mount
point. If the preceding mount point is NFS mountpoint, nfsiostat fails
to parse this line eventually. This patch avoids parsing this line.

Signed-off-by: Manjunath Patil <[email protected]>
---
tools/nfs-iostat/nfs-iostat.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index 61d15a5..577a23d 100644
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -429,6 +429,8 @@ def parse_stats_file(filename):
words = line.split()
if len(words) == 0:
continue
+ if line.startswith("no device mounted") :
+ continue
if words[0] == 'device':
key = words[4]
new = [ line.strip() ]
--
1.7.1



2017-10-05 14:56:03

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfsiostat: avoid parsing "no device mounted ..." line



On 09/22/2017 04:41 PM, Manjunath Patil wrote:
> Present nfsiostat includes the "no device mounted ..." line from
> /proc/self/mountstats as addition description of the preceding mount
> point. If the preceding mount point is NFS mountpoint, nfsiostat fails
> to parse this line eventually. This patch avoids parsing this line.
>
> Signed-off-by: Manjunath Patil <[email protected]>
Committed... Sorry it took so long...

steved.

> ---
> tools/nfs-iostat/nfs-iostat.py | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
> index 61d15a5..577a23d 100644
> --- a/tools/nfs-iostat/nfs-iostat.py
> +++ b/tools/nfs-iostat/nfs-iostat.py
> @@ -429,6 +429,8 @@ def parse_stats_file(filename):
> words = line.split()
> if len(words) == 0:
> continue
> + if line.startswith("no device mounted") :
> + continue
> if words[0] == 'device':
> key = words[4]
> new = [ line.strip() ]
>