Skip to contentSkip to conversation

Fix Python 3 compatibility of mountstats and nfs-iostat

PATCH In review Slavek Kabrda 2 participants 2 messages Jul 17, 2014 – Jul 25, 2014

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

PATCH 1/1 Fix Python 3 compatibility of mountstats and nfs-iostat

---
 tools/mountstats/mountstats.py | 2 +-
 tools/nfs-iostat/nfs-iostat.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
tools/mountstats/mountstats.py +1 -1
index e46105d..1fb3e2f 100644
@@ -371,7 +371,7 @@ def parse_stats_file(filename):
     ms_dict = dict()
     key = ''
 
-    f = file(filename)
+    f = open(filename)
     for line in f.readlines():
         words = line.split()
         if len(words) == 0:
tools/nfs-iostat/nfs-iostat.py +2 -1
index b324cd8..61d15a5 100644
@@ -213,7 +213,8 @@ class DeviceData:
         # the reference to them.  so we build new lists here
         # for the result object.
         for op in result.__rpc_data['ops']:
-            result.__rpc_data[op] = map(difference, self.__rpc_data[op], old_stats.__rpc_data[op])
+            result.__rpc_data[op] = list(map(
+                difference, self.__rpc_data[op], old_stats.__rpc_data[op]))
 
         # update the remaining keys we care about
         result.__rpc_data['rpcsends'] -= old_stats.__rpc_data['rpcsends']
Signature · 1 line
2.0.1
#1 lore raw
Quoted 1 line · Slavek Kabrda

Committed...

steved.

Quoted 33 lines
---
 tools/mountstats/mountstats.py | 2 +-
 tools/nfs-iostat/nfs-iostat.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
tools/mountstats/mountstats.py +1 -1
index e46105d..1fb3e2f 100644
@@ -371,7 +371,7 @@ def parse_stats_file(filename):
     ms_dict = dict()
     key = ''
 
-    f = file(filename)
+    f = open(filename)
     for line in f.readlines():
         words = line.split()
         if len(words) == 0:
tools/nfs-iostat/nfs-iostat.py +2 -1
index b324cd8..61d15a5 100644
@@ -213,7 +213,8 @@ class DeviceData:
         # the reference to them.  so we build new lists here
         # for the result object.
         for op in result.__rpc_data['ops']:
-            result.__rpc_data[op] = map(difference, self.__rpc_data[op], old_stats.__rpc_data[op])
+            result.__rpc_data[op] = list(map(
+                difference, self.__rpc_data[op], old_stats.__rpc_data[op]))
 
         # update the remaining keys we care about
         result.__rpc_data['rpcsends'] -= old_stats.__rpc_data['rpcsends']