v0.169.1: disk-health card excludes logical/network storage (pbs/lvm/nfs/cifs)

The agent defaults SMART to UNKNOWN on non-physical targets, so they showed as
spurious 'Nincs adat' rows. isPhysicalDisk now excludes those types (card + check).
Test strengthened: a PBS/LVM fixture with UNKNOWN SMART must still be excluded.
This commit is contained in:
2026-07-24 21:30:54 +02:00
parent c97975c1df
commit dbf631312e
3 changed files with 18 additions and 4 deletions
+7 -2
View File
@@ -62,9 +62,14 @@ func (s *Server) fetchDisks(ctx context.Context) (agentapi.DisksResponse, error)
return client.Disks(ctx)
}
// isPhysicalDisk reports whether a target is a physical disk SMART applies to (has a backing device
// or a serialized SMART summary). pbs/lvm/nfs targets are excluded from the disk-health view.
// isPhysicalDisk reports whether a target is a physical disk SMART applies to. Logical/network
// storage (PBS, LVM-thin, NFS, CIFS) is excluded even though the agent may default its SMART to
// UNKNOWN — those are storage abstractions, not disks, and must not clutter the disk-health card.
func isPhysicalDisk(d agentapi.DiskInfo) bool {
switch d.Type {
case "pbs", "lvmthin", "nfs", "cifs":
return false
}
return d.BackingDevice != "" || d.Smart != nil
}
+4 -2
View File
@@ -112,12 +112,14 @@ func TestDiskHealthRows_NilSmart(t *testing.T) {
s, _, payload := diskCheckHarness(t)
*payload = []agentapi.DiskInfo{
{Name: "sdb", BackingDevice: "/dev/sdb", Smart: nil}, // physical, no smart → Nincs adat
{Name: "felhom-pbs", Type: "pbs"}, // non-physical → excluded
// PBS/LVM carry a default UNKNOWN SMART from the agent — must STILL be excluded (not disks).
{Name: "felhom-pbs", Type: "pbs", Smart: &agentapi.SmartSummary{Health: agentapi.SmartUnknown}},
{Name: "local-lvm", Type: "lvmthin", Smart: &agentapi.SmartSummary{Health: agentapi.SmartUnknown}},
{Name: "sdc", BackingDevice: "/dev/sdc", Smart: &agentapi.SmartSummary{Health: agentapi.SmartPassed, TemperatureC: smartPtr(31)}}, // Rendben, 31°C
}
rows := s.diskHealthRows(context.Background())
if len(rows) != 2 {
t.Fatalf("want 2 physical-disk rows (pbs excluded), got %d: %+v", len(rows), rows)
t.Fatalf("want 2 physical-disk rows (pbs+lvm excluded), got %d: %+v", len(rows), rows)
}
byLabel := map[string]DiskHealthRow{}
for _, r := range rows {