fix(inspur): infer DIMM size from part number when BMC reports size=0

When BMC firmware fails to read capacity for a present DIMM, size_mb stays
0. If another DIMM with the same part number in the same batch has a known
size, use it to fill the gap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-05-21 14:18:15 +03:00
parent 9505303d1d
commit dfd64550cf
2 changed files with 23 additions and 1 deletions

View File

@@ -61,7 +61,7 @@ func TestParseMemoryInfo_PresentWithZeroSize(t *testing.T) {
t.Errorf("expected 2 present DIMMs, got %d", presentCount)
}
// Find CPU1_C0D0 (size=0 but serial present)
// Find CPU1_C0D0 (size=0 but serial present — size should be inferred from same part number)
found := false
for _, m := range hw.Memory {
if m.Slot == "CPU1_C0D0" {
@@ -72,6 +72,9 @@ func TestParseMemoryInfo_PresentWithZeroSize(t *testing.T) {
if m.SerialNumber != "K0UX000401205D2037" {
t.Errorf("wrong serial: %s", m.SerialNumber)
}
if m.SizeMB != 32768 {
t.Errorf("expected SizeMB=32768 inferred from part number, got %d", m.SizeMB)
}
}
}
if !found {