Detection of NVMe self-test support.

This commit is contained in:
Alexander Shaduri
2024-06-11 13:46:57 +04:00
parent 5c807e1859
commit e844b9949d
2 changed files with 16 additions and 2 deletions
+5 -2
View File
@@ -167,8 +167,11 @@ bool SelfTest::is_supported() const
return false; // not supported by nvme
case TestType::ShortTest:
case TestType::LongTest:
// NVMe spec
return true;
{
// Both short and long should be supported if the drive has a self-test log
const StorageProperty p = drive_->get_property_repository().lookup_property("nvme_self_test_log/_tests_supported");
return (!p.empty() && p.get_value<bool>());
}
}
} else if (drive_->get_detected_type() == StorageDeviceDetectedType::AtaAny
+11
View File
@@ -384,6 +384,17 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonNvmeParser::parse_section_self
bool section_properties_found = false;
// If nvme_self_test_log is present, the drive supports tests
{
StorageProperty p;
p.set_name("nvme_self_test_log/_tests_supported", "nvme_self_test_log/_tests_supported", _("Self-tests supported"));
p.section = StoragePropertySection::SelftestLog;
// p.show_in_ui = false;
p.value = get_node_exists(json_root_node, "nvme_self_test_log").value_or(false);
add_property(p);
}
{
StorageProperty p;
p.set_name("nvme_self_test_log/current_self_test_operation/value/_decoded",