Skip to content

Commit

Permalink
Fix TypeError: unorderable types: str() > int() in arc_summary.py
Browse files Browse the repository at this point in the history
Running arc_summary.py with a l2arc cache device around produces
the following error:

  Traceback (most recent call last):
    File "/usr/bin/arc_summary.py", line 1148, in <module>
      main()
    File "/usr/bin/arc_summary.py", line 1144, in main
      page(Kstat)
    File "/usr/bin/arc_summary.py", line 724, in _l2arc_summary
      arc["l2_arc_evicts"]["reading"] > 0:
  TypeError: unorderable types: str() > int()

This is due to arc["l2_arc_evicts"]['lock_retries'] and
arc["l2_arc_evicts"]["reading"] both being strings, returned
from fHits() earlier. Rather than adding them up and checking
if the result is > 0, this checks if either string is != '0'.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #5538
  • Loading branch information
jstenback authored and behlendorf committed Jan 3, 2017
1 parent 24d42e2 commit 5eac94b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/arc_summary/arc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ def _l2arc_summary(Kstat):
)
sys.stdout.write("\n")

if arc["l2_arc_evicts"]['lock_retries'] + \
arc["l2_arc_evicts"]["reading"] > 0:
if arc["l2_arc_evicts"]['lock_retries'] != '0' or \
arc["l2_arc_evicts"]["reading"] != '0':
sys.stdout.write("L2 ARC Evicts:\n")
sys.stdout.write("\tLock Retries:\t\t\t\t%s\n" %
arc["l2_arc_evicts"]['lock_retries'])
Expand Down

0 comments on commit 5eac94b

Please sign in to comment.