v0.94.0: serialize per-disk SMART into the /disks payload
Additive, backward-compatible (MinAgent floor unchanged). The SMART is already computed on the request path (storage.Observe -> enrich); this copies the target's Smart into localapi.DiskInfo (pointer, omitempty) only when Health != "", so an unread/absent summary stays omitted and the controller renders "Nincs adat". No new smartctl load, endpoint, or sudoers change. Test TestDisks_SmartSerialized + red-proof (drop the copy -> fails).
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/hub"
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/storage"
|
||||
)
|
||||
@@ -151,6 +152,12 @@ type DiskInfo struct {
|
||||
// at GuestPath (a host mount-table check) — i.e. live + usable in the guest in the intermediary model.
|
||||
// The controller's drive-absent gate + auto-restart key on this (and State).
|
||||
BoundUnderParent bool `json:"bound_under_parent"`
|
||||
// Smart is the already-computed per-disk SMART health summary (v0.94.0), serialized here so the
|
||||
// controller can render a disk-health card + degradation alert WITHOUT any new smartctl load — the
|
||||
// value is copied straight from the target's Observe-time enrichment. omitempty + a pointer so a
|
||||
// device that exposes no SMART (USB bridge, unread) is ABSENT, not a misleading zero-value UNKNOWN;
|
||||
// the controller feature-detects presence and renders "Nincs adat" when nil (never alarms).
|
||||
Smart *hub.SmartSummary `json:"smart,omitempty"`
|
||||
}
|
||||
|
||||
// handleDisks lists the host's drives + data-bearing flags (read-only/benign).
|
||||
@@ -206,6 +213,13 @@ func (s *Server) handleDisks(w http.ResponseWriter, r *http.Request, vmid int) {
|
||||
di.WipeDurableID = wid
|
||||
}
|
||||
}
|
||||
// v0.94.0: surface the already-computed SMART only when it was actually read (Health set).
|
||||
// A zero-value summary (enrich skipped / no smartctl device) has Health "" → stays omitted, so
|
||||
// the controller sees "absent" and renders "Nincs adat" rather than a false UNKNOWN.
|
||||
if t.Smart.Health != "" {
|
||||
sm := t.Smart
|
||||
di.Smart = &sm
|
||||
}
|
||||
out = append(out, di)
|
||||
}
|
||||
// Impl-2a: union in registry+units drives that Observe() does NOT surface (a drive with no PVE
|
||||
|
||||
Reference in New Issue
Block a user