Skip to content

Commit

Permalink
silence exception on error log so we might get our SMART readings roc…
Browse files Browse the repository at this point in the history
…kstor#657

This is at least better than a wall of red text and in tests so far produces
viable results, but we now need to deal with the return code in an informative
manner.
  • Loading branch information
phillxnet committed Oct 12, 2015
1 parent f8bbd07 commit ae83845
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/rockstor/system/smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ def capabilities(device):
return cap_d

def error_logs(device):
o, e, rc = run_command([SMART, '-l', 'error', '/dev/%s' % device])
o, e, rc = run_command([SMART, '-l', 'error', '/dev/%s' % device],
throw=False)
# As we mute exceptions when calling the above command we should at least
# examine what we have as return code (rc); 64 has been seen when the error
# log contains errors so we deal with it.
if rc == 64:
msg = ('Drive /dev/%s has logged SMART errors. Please view '\
'the Error logs tab for this device' % device)
logger.info(msg)
ecode_map = {
'ABRT' : 'Command ABoRTed',
'AMNF' : 'Address Mark Not Found',
Expand Down

0 comments on commit ae83845

Please sign in to comment.