Added SMART 199/C7 warning/override to HW-Diags
This commit is contained in:
parent
8fec6fc5b9
commit
9f12f2c856
1 changed files with 31 additions and 12 deletions
|
|
@ -132,6 +132,15 @@ def get_smart_details(dev):
|
||||||
# Let other sections deal with the missing data
|
# Let other sections deal with the missing data
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
def get_smart_value(smart_data, smart_id):
|
||||||
|
"""Get SMART value from table, returns int or None."""
|
||||||
|
value = None
|
||||||
|
table = smart_data.get('ata_smart_attributes', {}).get('table', [])
|
||||||
|
for row in table:
|
||||||
|
if str(row.get('id', '?')) == str(smart_id):
|
||||||
|
value = row.get('raw', {}).get('value', None)
|
||||||
|
return value
|
||||||
|
|
||||||
def get_status_color(s):
|
def get_status_color(s):
|
||||||
"""Get color based on status, returns str."""
|
"""Get color based on status, returns str."""
|
||||||
color = COLORS['CLEAR']
|
color = COLORS['CLEAR']
|
||||||
|
|
@ -737,19 +746,29 @@ def scan_disks(full_paths=False, only_path=None):
|
||||||
data['SMART Support'] = False
|
data['SMART Support'] = False
|
||||||
|
|
||||||
# Ask for manual overrides if necessary
|
# Ask for manual overrides if necessary
|
||||||
if not data['Quick Health OK'] and (TESTS['badblocks']['Enabled'] or TESTS['iobenchmark']['Enabled']):
|
if TESTS['badblocks']['Enabled'] or TESTS['iobenchmark']['Enabled']:
|
||||||
show_disk_details(data)
|
show_disk_details(data)
|
||||||
print_warning("WARNING: Health can't be confirmed for: {}".format(
|
needs_override = False
|
||||||
'/dev/{}'.format(dev)))
|
if not data['Quick Health OK']:
|
||||||
dev_name = data['lsblk']['name']
|
needs_override = True
|
||||||
print_standard(' ')
|
print_warning(
|
||||||
if ask('Run tests on this device anyway?'):
|
"WARNING: Health can't be confirmed for: /dev/{}".format(dev))
|
||||||
TESTS['NVMe/SMART']['Status'][dev_name] = 'OVERRIDE'
|
if get_smart_value(data['smartctl'], '199'):
|
||||||
else:
|
# SMART attribute present and it's value is non-zero
|
||||||
TESTS['NVMe/SMART']['Status'][dev_name] = 'NS'
|
needs_override = True
|
||||||
TESTS['badblocks']['Status'][dev_name] = 'Denied'
|
print_warning(
|
||||||
TESTS['iobenchmark']['Status'][dev_name] = 'Denied'
|
'WARNING: SMART 199/C7 error detected on /dev/{}'.format(dev))
|
||||||
print_standard(' ') # In case there's more than one "OVERRIDE" disk
|
print_standard(' (Have you tried swapping the drive cable?)')
|
||||||
|
if needs_override:
|
||||||
|
dev_name = data['lsblk']['name']
|
||||||
|
print_standard(' ')
|
||||||
|
if ask('Run tests on this device anyway?'):
|
||||||
|
TESTS['NVMe/SMART']['Status'][dev_name] = 'OVERRIDE'
|
||||||
|
else:
|
||||||
|
TESTS['NVMe/SMART']['Status'][dev_name] = 'NS'
|
||||||
|
TESTS['badblocks']['Status'][dev_name] = 'Denied'
|
||||||
|
TESTS['iobenchmark']['Status'][dev_name] = 'Denied'
|
||||||
|
print_standard(' ') # In case there's more than one "OVERRIDE" disk
|
||||||
|
|
||||||
TESTS['NVMe/SMART']['Devices'] = devs
|
TESTS['NVMe/SMART']['Devices'] = devs
|
||||||
TESTS['badblocks']['Devices'] = devs
|
TESTS['badblocks']['Devices'] = devs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue