Fix SCSI/SAS drive identity fields (model, wwn, firmware)
This commit is contained in:
@@ -75,20 +75,21 @@ def _parse_smart_json(device: str, data: dict) -> dict:
|
||||
"""Extract relevant fields from smartctl JSON output."""
|
||||
result: dict = {"device": device, "smart_supported": True}
|
||||
|
||||
# Identity
|
||||
result["model"] = data.get("model_name")
|
||||
# Identity — ATA vs SCSI field names
|
||||
result["model"] = data.get("model_name") or data.get("scsi_model_name")
|
||||
result["serial"] = data.get("serial_number")
|
||||
result["firmware"] = data.get("firmware_version")
|
||||
result["firmware"] = data.get("firmware_version") or data.get("scsi_revision_level")
|
||||
result["capacity_bytes"] = data.get("user_capacity", {}).get("bytes")
|
||||
|
||||
# WWN
|
||||
# WWN — ATA uses structured wwn{}, SCSI uses logical_unit_id string
|
||||
wwn_data = data.get("wwn")
|
||||
if wwn_data:
|
||||
# Reconstruct WWN string from components
|
||||
naa = wwn_data.get("naa", 0)
|
||||
oui = wwn_data.get("oui", 0)
|
||||
wwn_id = wwn_data.get("id", 0)
|
||||
result["wwn"] = f"{naa:x}{oui:06x}{wwn_id:09x}"
|
||||
elif data.get("logical_unit_id"):
|
||||
result["wwn"] = data["logical_unit_id"]
|
||||
|
||||
# SMART health
|
||||
smart_status = data.get("smart_status", {})
|
||||
|
||||
Reference in New Issue
Block a user