From ce8dddd9b74e76e133cb597b1a18f752d8f650e4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 9 Apr 2021 01:38:30 -0600 Subject: [PATCH 1/3] Include note if attributes fail mid-diagnostics --- scripts/wk/hw/diags.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index 09ccfe47..e6ce5540 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -176,6 +176,13 @@ class State(): if 'Disk Attributes' in disk.tests: disk.tests['Disk Attributes'].failed = True disk.tests['Disk Attributes'].set_status('Failed') + if not prep: + # Mid-diag failure detected + LOG.warning('Critical hardware error detected during diagnostics') + disk.add_note( + 'Critical hardware error detected during diagnostics', + 'YELLOW', + ) except hw_obj.SMARTSelfTestInProgressError as err: if prep: std.print_warning(f'SMART self-test(s) in progress for {disk.path}') @@ -198,12 +205,18 @@ class State(): std.color_string('Please manually review SMART data', 'YELLOW'), ) else: - # No blocking errors encountered, check for minor attribute failures - if ('Disk Attributes' in disk.tests + if ( + 'Disk Attributes' in disk.tests and not disk.tests['Disk Attributes'].failed and not disk.check_attributes(only_blocking=False)): - # Mid-diag failure detected - LOG.warning('Disk attributes failure detected during diagnostics') + # No blocking errors encountered, but found minor attribute failures + if not prep: + # Mid-diag failure detected + LOG.warning('Attribute(s) failure detected during diagnostics') + disk.add_note( + 'Attribute(s) failure detected during diagnostics', + 'YELLOW', + ) disk.tests['Disk Attributes'].failed = True disk.tests['Disk Attributes'].set_status('Failed') From b3a667641d6364876885ebb1f57253a8e5f531c6 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 9 Apr 2021 02:29:06 -0600 Subject: [PATCH 2/3] Show failed attributes during surface scans --- scripts/wk/hw/diags.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index e6ce5540..9f4bfc4f 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -1021,7 +1021,7 @@ def disk_self_test(state, test_objects): def disk_surface_scan(state, test_objects): - # pylint: disable=too-many-statements + # pylint: disable=too-many-branches,too-many-statements """Read-only disk surface scan using badblocks.""" LOG.info('Disk Surface Scan (badblocks)') aborted = False @@ -1087,13 +1087,29 @@ def disk_surface_scan(state, test_objects): if not (test_obj.passed or test_obj.failed): test_obj.set_status('Unknown') - # Run surface scans + # Update panes state.update_top_pane( f'Disk Surface Scan{"s" if len(test_objects) > 1 else ""}', ) std.print_info( f'Starting disk surface scan{"s" if len(test_objects) > 1 else ""}', ) + for disk in state.disks: + failed_attributes = [ + line for line in disk.generate_attribute_report() if 'failed' in line + ] + if failed_attributes: + size_str = std.bytes_to_string(disk.details["size"], use_binary=False) + std.print_colored( + ['[', disk.path.name, ' ', size_str, ']'], + [None, 'BLUE', None, 'CYAN', None], + sep='', + ) + #std.print_colored([disk.path.name, disk.description], [None, 'BLUE']) + std.print_report(failed_attributes) + std.print_standard('') + + # Run surface scans for test in reversed(test_objects): if test.disabled: # Skip From 66bf189e55bc463a4bfcdecd9405955b14d116aa Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 9 Apr 2021 03:02:28 -0600 Subject: [PATCH 3/3] Disable benchmark tests on surface scan failures --- scripts/wk/hw/diags.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index 9f4bfc4f..d0763648 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -158,7 +158,7 @@ class State(): self.panes.pop(key) def disk_safety_checks(self, prep=False, wait_for_self_tests=True): - # pylint: disable=too-many-branches + # pylint: disable=too-many-branches,too-many-statements """Run disk safety checks.""" self_tests_in_progress = False for disk in self.disks: @@ -208,7 +208,8 @@ class State(): if ( 'Disk Attributes' in disk.tests and not disk.tests['Disk Attributes'].failed - and not disk.check_attributes(only_blocking=False)): + and not disk.check_attributes(only_blocking=False) + ): # No blocking errors encountered, but found minor attribute failures if not prep: # Mid-diag failure detected @@ -220,6 +221,16 @@ class State(): disk.tests['Disk Attributes'].failed = True disk.tests['Disk Attributes'].set_status('Failed') + # Check Surface Scan + if ( + 'Disk Surface Scan' in disk.tests + and disk.tests['Disk Surface Scan'].failed + and 'Disk I/O Benchmark' in disk.tests + ): + # Disable I/O Benchmark test + disk.tests['Disk I/O Benchmark'].set_status('Skipped') + disk.tests['Disk I/O Benchmark'].disabled = True + # Disable tests if necessary if disable_tests: disk.disable_disk_tests()