fix(disks): read the SMART verdict and md membership correctly (#4) #15

Merged
christianmanivong merged 3 commits from fix/bugs-2026-11 into main 2026-11-01 21:59:57 +00:00
Owner

Disk health reads smartctl's overall verdict, and md membership matches only the disk or its own partitions.

  • smartctl -iHA; the verdict line ("SMART overall-health self-assessment test result" for ATA/NVMe, "SMART Health Status" for SCSI/SAS) decides. Before, every ATA disk whose attribute table was printed read failed, because the table header contains WHEN_FAILED; NVMe and SCSI disks read unknown.

  • md membership: sda no longer matches sdaa1, nvme0n1 no longer nvme0n11; /proc/mdstat is read once per get_disks().

  • fix(disks): a SAS disk's temperature (Current Drive Temperature: 28 C) is read; before, every SAS disk read -1. A reading of 0 C (QEMU disks without a sensor) stays unknown.

Tested: tests/test_disks.py against recorded smartctl -iHA output (ATA SSD, NVMe, SAS, a QEMU disk without SMART; smartmontools 7.4/7.5; serials and WWNs replaced) in tests/fixtures/. The failing-disk cases are a recording with only the verdict line changed; md-array tests still use a hand-written mdstat (no recorded host has an array).

Closes #4

Disk health reads smartctl's overall verdict, and md membership matches only the disk or its own partitions. - `smartctl -iHA`; the verdict line ("SMART overall-health self-assessment test result" for ATA/NVMe, "SMART Health Status" for SCSI/SAS) decides. Before, every ATA disk whose attribute table was printed read **failed**, because the table header contains `WHEN_FAILED`; NVMe and SCSI disks read unknown. - md membership: `sda` no longer matches `sdaa1`, `nvme0n1` no longer `nvme0n11`; `/proc/mdstat` is read once per `get_disks()`. - `fix(disks)`: a SAS disk's temperature (`Current Drive Temperature: 28 C`) is read; before, every SAS disk read -1. A reading of `0 C` (QEMU disks without a sensor) stays unknown. Tested: `tests/test_disks.py` against **recorded** `smartctl -iHA` output (ATA SSD, NVMe, SAS, a QEMU disk without SMART; smartmontools 7.4/7.5; serials and WWNs replaced) in `tests/fixtures/`. The failing-disk cases are a recording with only the verdict line changed; md-array tests still use a hand-written mdstat (no recorded host has an array). Closes #4
christianmanivong added 1 commit 2026-11-01 20:54:36 +00:00
fix(disks): read the SMART verdict and md membership correctly
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m34s
driver / publish (pull_request) Skipped
6b9ba25773
get_disks ran smartctl -iA, and neither -i nor -A prints the overall
verdict: only -H does. A disk read unknown, and an ATA disk read failed
from the WHEN_FAILED column header of its attribute table. It now asks
-iHA and reads the verdict line (ATA/NVMe) or SCSI health status only.

Array membership matched the disk name as a substring of the mdstat
line, so sda joined the array of sdaa1. A disk now owns only itself and
its partitions, and /proc/mdstat is read once per call.

Closes #4
christianmanivong added 2 commits 2026-11-01 21:20:36 +00:00
The get_disks tests ran against hand-written smartctl sections. They now
read smartctl -iHA as recorded on real hosts: an ATA SATA DOM and an
NVMe SSD (PASSED), a SAS SSD (OK) and a QEMU disk without SMART, with
serial numbers, WWNs and LU ids replaced. The failing verdicts replace
the verdict line of a recording, as no failing disk was at hand. A
recorded /proc/mdstat without arrays is added too.
fix(disks): read a SAS disk's temperature
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 58s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m35s
driver / publish (pull_request) Skipped
e09af917c8
A SCSI/SAS disk prints its temperature as "Current Drive Temperature:
28 C", which matched none of the ATA and NVMe patterns, so every SAS
disk read -1. Found in the smartctl output recorded from a Proxmox host.
A QEMU disk without a sensor prints 0 C there and keeps reading -1.
christianmanivong merged commit 099eef7f3e into main 2026-11-01 21:59:57 +00:00
christianmanivong deleted branch fix/bugs-2026-11 2026-11-01 21:59:57 +00:00
Sign in to join this conversation.