Fail drives for old age but allow further testing

* Addresses issue #103
This commit is contained in:
2Shirt 2019-07-03 19:32:25 -06:00
parent 0077240255
commit 8c6fcfe99c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 17 additions and 2 deletions

View file

@ -166,6 +166,18 @@ class DiskObj():
# self.dd_skip_extra == 0 is fine
pass
def is_aging(self):
"""Check if power-on hours is above the threshold, returns bool."""
if self.nvme_attributes:
poh = self.nvme_attributes.get('power_on_hours', {}).get('raw', -1)
elif self.smart_attributes:
poh = self.smart_attributes.get(9, {}).get('raw', -1)
error_thresh = ATTRIBUTES['SMART'][9]['Error']
max_thresh = ATTRIBUTES['SMART'][9]['Maximum']
return error_thresh <= poh < max_thresh
def check_attributes(self):
"""Check NVMe / SMART attributes for errors, returns bool."""
attr_type = self.attr_type
@ -1745,6 +1757,9 @@ def run_nvme_smart_tests(state, test, update_mode=False):
if test.failed and not update_mode:
for t in ['badblocks', 'I/O Benchmark']:
dev.disable_test(t, 'Denied')
if dev.is_aging() and not update_mode:
test.failed = True
test.update_status('FAIL')
# Done
update_progress_pane(state)

View file

@ -76,12 +76,12 @@ ATTRIBUTES = {
'NVMe': {
'critical_warning': {'Critical': True, 'Ignore': False, 'Warning': None, 'Error': 1, 'Maximum': None, },
'media_errors': {'Critical': True, 'Ignore': False, 'Warning': None, 'Error': 1, 'Maximum': None, },
'power_on_hours': {'Critical': False, 'Ignore': True, 'Warning': 17532, 'Error': 26298, 'Maximum': None, },
'power_on_hours': {'Critical': False, 'Ignore': True, 'Warning': 17532, 'Error': 26298, 'Maximum': 122724,},
'unsafe_shutdowns': {'Critical': False, 'Ignore': True, 'Warning': 1, 'Error': None, 'Maximum': None, },
},
'SMART': {
5: {'Hex': '05', 'Critical': True, 'Ignore': False, 'Warning': None, 'Error': 1, 'Maximum': None, },
9: {'Hex': '09', 'Critical': False, 'Ignore': True, 'Warning': 17532, 'Error': 26298, 'Maximum': None, },
9: {'Hex': '09', 'Critical': False, 'Ignore': True, 'Warning': 17532, 'Error': 26298, 'Maximum': 122724,},
10: {'Hex': '10', 'Critical': False, 'Ignore': False, 'Warning': 1, 'Error': 10, 'Maximum': 10000, },
184: {'Hex': 'B8', 'Critical': False, 'Ignore': False, 'Warning': 1, 'Error': 10, 'Maximum': 10000, },
187: {'Hex': 'BB', 'Critical': False, 'Ignore': False, 'Warning': 1, 'Error': 10, 'Maximum': 10000, },