Linux NFS development
 help / color / mirror / Atom feed
* [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats()
@ 2015-12-10 17:07 Scott Mayhew
  2015-12-10 17:07 ` [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations Scott Mayhew
  2015-12-12 12:16 ` [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Steve Dickson
  0 siblings, 2 replies; 4+ messages in thread
From: Scott Mayhew @ 2015-12-10 17:07 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

This will prevent a backtrace like this from occurring in 'mountstats
nfsstat' if a new NFSv4 operation is added to the kernel but not to the
Nfsv4ops list in mountstats.py:

Traceback (most recent call last):
  File "/sbin/mountstats", line 988, in <module>
    res = main()
  File "/sbin/mountstats", line 977, in main
    return args.func(args)
  File "/sbin/mountstats", line 792, in nfsstat_command
    v4stats.accumulate_iostats(acc_stats)
  File "/sbin/mountstats", line 566, in accumulate_iostats
    self.__rpc_data[op] = list(map(add, self.__rpc_data[op],
new_stats.__rpc_data[op]))
KeyError: 'SEEK'

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 tools/mountstats/mountstats.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 011bb42..1e2811f 100644
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -563,7 +563,10 @@ class DeviceData:
         for the nfsstat command.
         """
         for op in new_stats.__rpc_data['ops']:
-            self.__rpc_data[op] = list(map(add, self.__rpc_data[op], new_stats.__rpc_data[op]))
+            try:
+                self.__rpc_data[op] = list(map(add, self.__rpc_data[op], new_stats.__rpc_data[op]))
+            except KeyError:
+                continue
 
     def __print_rpc_op_stats(self, op, sample_time):
         """Print generic stats for one RPC op
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations
  2015-12-10 17:07 [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Scott Mayhew
@ 2015-12-10 17:07 ` Scott Mayhew
  2015-12-12 12:15   ` Steve Dickson
  2015-12-12 12:16 ` [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Steve Dickson
  1 sibling, 1 reply; 4+ messages in thread
From: Scott Mayhew @ 2015-12-10 17:07 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 tools/mountstats/mountstats.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 1e2811f..4ca4bc4 100644
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -150,6 +150,8 @@ Nfsv3ops = [
     'COMMIT'
 ]
 
+# This list should be kept in-sync with the NFSPROC4_CLNT_* enum in
+# include/linux/nfs4.h in the kernel.
 Nfsv4ops = [
     'NULL',
     'READ',
@@ -204,7 +206,12 @@ Nfsv4ops = [
     'FREE_STATEID',
     'GETDEVICELIST',
     'BIND_CONN_TO_SESSION',
-    'DESTROY_CLIENTID'
+    'DESTROY_CLIENTID',
+    'SEEK',
+    'ALLOCATE',
+    'DEALLOCATE',
+    'LAYOUTSTATS',
+    'CLONE'
 ]
 
 class DeviceData:
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations
  2015-12-10 17:07 ` [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations Scott Mayhew
@ 2015-12-12 12:15   ` Steve Dickson
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2015-12-12 12:15 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: linux-nfs



On 12/10/2015 12:07 PM, Scott Mayhew wrote:
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed...

steved.
> ---
>  tools/mountstats/mountstats.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
> index 1e2811f..4ca4bc4 100644
> --- a/tools/mountstats/mountstats.py
> +++ b/tools/mountstats/mountstats.py
> @@ -150,6 +150,8 @@ Nfsv3ops = [
>      'COMMIT'
>  ]
>  
> +# This list should be kept in-sync with the NFSPROC4_CLNT_* enum in
> +# include/linux/nfs4.h in the kernel.
>  Nfsv4ops = [
>      'NULL',
>      'READ',
> @@ -204,7 +206,12 @@ Nfsv4ops = [
>      'FREE_STATEID',
>      'GETDEVICELIST',
>      'BIND_CONN_TO_SESSION',
> -    'DESTROY_CLIENTID'
> +    'DESTROY_CLIENTID',
> +    'SEEK',
> +    'ALLOCATE',
> +    'DEALLOCATE',
> +    'LAYOUTSTATS',
> +    'CLONE'
>  ]
>  
>  class DeviceData:
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats()
  2015-12-10 17:07 [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Scott Mayhew
  2015-12-10 17:07 ` [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations Scott Mayhew
@ 2015-12-12 12:16 ` Steve Dickson
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2015-12-12 12:16 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: linux-nfs



On 12/10/2015 12:07 PM, Scott Mayhew wrote:
> This will prevent a backtrace like this from occurring in 'mountstats
> nfsstat' if a new NFSv4 operation is added to the kernel but not to the
> Nfsv4ops list in mountstats.py:
> 
> Traceback (most recent call last):
>   File "/sbin/mountstats", line 988, in <module>
>     res = main()
>   File "/sbin/mountstats", line 977, in main
>     return args.func(args)
>   File "/sbin/mountstats", line 792, in nfsstat_command
>     v4stats.accumulate_iostats(acc_stats)
>   File "/sbin/mountstats", line 566, in accumulate_iostats
>     self.__rpc_data[op] = list(map(add, self.__rpc_data[op],
> new_stats.__rpc_data[op]))
> KeyError: 'SEEK'
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... 

steved.

> ---
>  tools/mountstats/mountstats.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
> index 011bb42..1e2811f 100644
> --- a/tools/mountstats/mountstats.py
> +++ b/tools/mountstats/mountstats.py
> @@ -563,7 +563,10 @@ class DeviceData:
>          for the nfsstat command.
>          """
>          for op in new_stats.__rpc_data['ops']:
> -            self.__rpc_data[op] = list(map(add, self.__rpc_data[op], new_stats.__rpc_data[op]))
> +            try:
> +                self.__rpc_data[op] = list(map(add, self.__rpc_data[op], new_stats.__rpc_data[op]))
> +            except KeyError:
> +                continue
>  
>      def __print_rpc_op_stats(self, op, sample_time):
>          """Print generic stats for one RPC op
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-12 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 17:07 [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Scott Mayhew
2015-12-10 17:07 ` [nfs-utils PATCH v2 2/2] mountstats: add missing v4.2 operations Scott Mayhew
2015-12-12 12:15   ` Steve Dickson
2015-12-12 12:16 ` [nfs-utils PATCH v2 1/2] mountstats: handle KeyError in accumulate_iostats() Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox