mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-21 00:47:47 +02:00
fix(agent): avoid RAID health warnings during healthy scrubs (#2109)
This commit is contained in:
@@ -201,12 +201,9 @@ func mdraidSmartStatus(health mdraidHealth) string {
|
|||||||
if health.mismatchCnt > 0 {
|
if health.mismatchCnt > 0 {
|
||||||
return "WARNING"
|
return "WARNING"
|
||||||
}
|
}
|
||||||
// "check" scans for consistency problems without repairing mismatches.
|
// "check" and "repair" are requested consistency scans, not evidence of
|
||||||
// With no mismatches, keep it green while reporting progress attributes.
|
// array failure. With no health issues above, keep scrubbing green while
|
||||||
switch syncAction {
|
// reporting the sync action and progress attributes.
|
||||||
case "repair":
|
|
||||||
return "WARNING"
|
|
||||||
}
|
|
||||||
switch state {
|
switch state {
|
||||||
case "clean", "active", "active-idle", "write-pending", "read-auto", "readonly":
|
case "clean", "active", "active-idle", "write-pending", "read-auto", "readonly":
|
||||||
return "PASSED"
|
return "PASSED"
|
||||||
|
|||||||
@@ -174,8 +174,25 @@ func TestMdraidSmartStatus(t *testing.T) {
|
|||||||
if got := mdraidSmartStatus(mdraidHealth{arrayState: "clean", mismatchCnt: 1}); got != "WARNING" {
|
if got := mdraidSmartStatus(mdraidHealth{arrayState: "clean", mismatchCnt: 1}); got != "WARNING" {
|
||||||
t.Fatalf("mdraidSmartStatus(clean+mismatch) = %q, want WARNING", got)
|
t.Fatalf("mdraidSmartStatus(clean+mismatch) = %q, want WARNING", got)
|
||||||
}
|
}
|
||||||
if got := mdraidSmartStatus(mdraidHealth{arrayState: "clean", syncAction: "repair"}); got != "WARNING" {
|
for _, tc := range []struct {
|
||||||
t.Fatalf("mdraidSmartStatus(repair) = %q, want WARNING", got)
|
name string
|
||||||
|
health mdraidHealth
|
||||||
|
want string
|
||||||
|
}{
|
||||||
|
{"clean", mdraidHealth{arrayState: "clean"}, "PASSED"},
|
||||||
|
{"active", mdraidHealth{arrayState: "active"}, "PASSED"},
|
||||||
|
{"mismatch", mdraidHealth{arrayState: "active", mismatchCnt: 1}, "WARNING"},
|
||||||
|
{"degraded", mdraidHealth{arrayState: "active", degraded: 1}, "FAILED"},
|
||||||
|
{"faulty member", mdraidHealth{arrayState: "active", faultyDisks: 1}, "FAILED"},
|
||||||
|
{"inactive", mdraidHealth{arrayState: "inactive"}, "FAILED"},
|
||||||
|
{"unknown", mdraidHealth{arrayState: "unknown"}, "UNKNOWN"},
|
||||||
|
} {
|
||||||
|
t.Run("repair/"+tc.name, func(t *testing.T) {
|
||||||
|
tc.health.syncAction = "repair"
|
||||||
|
if got := mdraidSmartStatus(tc.health); got != tc.want {
|
||||||
|
t.Fatalf("mdraidSmartStatus(%+v) = %q, want %s", tc.health, got, tc.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if got := mdraidSmartStatus(mdraidHealth{arrayState: "clean"}); got != "PASSED" {
|
if got := mdraidSmartStatus(mdraidHealth{arrayState: "clean"}); got != "PASSED" {
|
||||||
t.Fatalf("mdraidSmartStatus(clean) = %q, want PASSED", got)
|
t.Fatalf("mdraidSmartStatus(clean) = %q, want PASSED", got)
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
- Fix missing root CA certificates in base agent image (#2291)
|
- Fix missing root CA certificates in base agent image (#2291)
|
||||||
|
|
||||||
|
- Fix false RAID health warnings during healthy data scrubbing (#2109)
|
||||||
|
|
||||||
- Fix ZFS monitoring when /dev/zfs is unavailable (#2325)
|
- Fix ZFS monitoring when /dev/zfs is unavailable (#2325)
|
||||||
|
|
||||||
- Fix spurious `HUB_URL` warning in SSH-only mode (#2316)
|
- Fix spurious `HUB_URL` warning in SSH-only mode (#2316)
|
||||||
|
|||||||
Reference in New Issue
Block a user