From 4b7e34eb1749a031a09742f805f59e2abbe06292 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 18 Nov 2019 20:47:13 -0700 Subject: [PATCH] Only disable disk tests for critical errors --- .bin/Scripts/functions/hw_diags.py | 69 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 0aa38ccd..38559540 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -483,45 +483,45 @@ class DiskObj(): """Run safety checks and disable tests if necessary.""" test_running = False if self.nvme_attributes or self.smart_attributes: - disk_ok = self.check_attributes() + self.disk_ok = self.check_attributes() test_running = self.check_smart_self_test(silent) # Show errors (unless a SMART self-test is running) - if not (silent or test_running): - if disk_ok: - # 199/C7 warning - if self.smart_attributes.get(199, {}).get('raw', 0) > 0: - print_warning('199/C7 error detected') - print_standard(' (Have you tried swapping the disk cable?)') - else: - # Override? - show_report( - self.generate_attribute_report(description=True), - log_report=True) - print_warning(' {} error(s) detected.'.format(self.attr_type)) - if self.override_disabled: - print_standard('Tests disabled for this device') - pause() - elif not (len(self.tests) == 3 and OVERRIDES_LIMITED): - if OVERRIDES_FORCED or ask('Run tests on this device anyway?'): - disk_ok = True - if 'NVMe / SMART' in self.tests: - self.disable_test('NVMe / SMART', 'OVERRIDE') - if not self.nvme_attributes and self.smart_attributes: - # Re-enable for SMART short-tests - self.tests['NVMe / SMART'].disabled = False - print_standard(' ') + #if not (silent or test_running): + # if self.disk_ok: + # # 199/C7 warning + # if self.smart_attributes.get(199, {}).get('raw', 0) > 0: + # print_warning('199/C7 error detected') + # print_standard(' (Have you tried swapping the disk cable?)') + # else: + # # Override? + # show_report( + # self.generate_attribute_report(description=True), + # log_report=True) + # print_warning(' {} error(s) detected.'.format(self.attr_type)) + # if self.override_disabled: + # print_standard('Tests disabled for this device') + # pause() + # elif not (len(self.tests) == 3 and OVERRIDES_LIMITED): + # if OVERRIDES_FORCED or ask('Run tests on this device anyway?'): + # self.disk_ok = True + # if 'NVMe / SMART' in self.tests: + # self.disable_test('NVMe / SMART', 'OVERRIDE') + # if not self.nvme_attributes and self.smart_attributes: + # # Re-enable for SMART short-tests + # self.tests['NVMe / SMART'].disabled = False + # print_standard(' ') else: # No NVMe/SMART details self.disable_test('NVMe / SMART', 'N/A') - if silent: - disk_ok = OVERRIDES_FORCED - else: - show_report( - self.generate_attribute_report(description=True), - log_report=True) - disk_ok = OVERRIDES_FORCED or ask('Run tests on this device anyway?') - print_standard(' ') + #if silent: + # self.disk_ok = OVERRIDES_FORCED + #else: + # show_report( + # self.generate_attribute_report(description=True), + # log_report=True) + # self.disk_ok = OVERRIDES_FORCED or ask('Run tests on this device anyway?') + # print_standard(' ') # Disable tests if necessary (statuses won't be overwritten) if test_running: @@ -530,7 +530,8 @@ class DiskObj(): self.disable_test('NVMe / SMART', 'Denied') for t in ['badblocks', 'I/O Benchmark']: self.disable_test(t, 'Denied') - elif not disk_ok: + elif self.override_disabled: + # Critical disk error, disable all tests self.disable_test('NVMe / SMART', 'FAIL', test_failed=True) for t in ['badblocks', 'I/O Benchmark']: self.disable_test(t, 'Denied')