v0.95.0: SMART coverage — union-path drives + LVM/dm root + device model

Implements SPIKE-smart-coverage-2026-07-25 fixes B+A (additive; MinAgent unchanged).
Fix B: storage.SmartReader.SMARTForBacking wired into the /disks union path (localapi
Smart seam) so registry/USB drives get a real SMART read (watchdog Known stays
enrich-free). Fix A: smartDeviceFor resolves dm/LVM to the whole disk via
/sys/block/<dm>/slaves (recursive; skips >1-disk); the builtin local dir on the LVM
root gets a SMART-only device from its containing filesystem (never touches
backing/durable_id). SmartSummary.ModelName captured from smartctl. Fix C (-d sat)
stays rejected. Tests + red-proofs (dm multi-disk skip, enrich smartHint, union
routing); Known-path-never-SMARTs asserted.
This commit is contained in:
2026-07-25 08:21:45 +02:00
parent 643899c191
commit ed97232598
13 changed files with 579 additions and 74 deletions
+8 -1
View File
@@ -255,10 +255,17 @@ func (s *Server) handleDisks(w http.ResponseWriter, r *http.Request, vmid int) {
if d.UUID != "" {
// Resolve to the real /dev node (e.g. /dev/sdd), not the by-uuid symlink path, to match
// how Observe-sourced rows display the backing device.
if dev, err := storage.ResolveStorageDevice("uuid:" + d.UUID); err == nil {
if dev, err := s.resolveStorageDevice("uuid:" + d.UUID); err == nil {
di.BackingDevice = dev
}
}
// Fix B (v0.95.0): union-path drives skip Observe's enrich, so read SMART here through the
// same seam the dir targets use. Only set when the read actually ran (Health != "").
if di.BackingDevice != "" && s.smart != nil {
if sm := s.smart.SMARTForBacking(r.Context(), di.BackingDevice); sm.Health != "" {
di.Smart = &sm
}
}
if total, used, okc := statfsCapacity(d.MountPath); okc {
di.TotalBytes, di.UsedBytes = total, used
di.UsedFraction = float64(used) / float64(total)