collector/redfish: fix server model fallback and GPU/NVMe regressions

This commit is contained in:
2026-02-28 14:50:02 +03:00
parent a2c9e9a57f
commit f35cabac48
3 changed files with 146 additions and 5 deletions
+26 -2
View File
@@ -448,7 +448,7 @@ func dedupeStrings(items []string) []string {
func (r redfishSnapshotReader) collectBoardFallbackDocs(chassisPaths []string) []map[string]interface{} {
out := make([]map[string]interface{}, 0)
for _, chassisPath := range chassisPaths {
for _, suffix := range []string{"/Boards", "/Backplanes", "/Assembly"} {
for _, suffix := range []string{"/Boards", "/Backplanes"} {
path := joinPath(chassisPath, suffix)
if docs, err := r.getCollectionMembers(path); err == nil && len(docs) > 0 {
out = append(out, docs...)
@@ -468,6 +468,9 @@ func applyBoardInfoFallbackFromDocs(board *models.BoardInfo, docs []map[string]i
}
for _, doc := range docs {
candidate := parseBoardInfoFromFRUDoc(doc)
if !isLikelyServerProductName(candidate.ProductName) {
continue
}
if board.Manufacturer == "" {
board.Manufacturer = candidate.Manufacturer
}
@@ -486,6 +489,27 @@ func applyBoardInfoFallbackFromDocs(board *models.BoardInfo, docs []map[string]i
}
}
func isLikelyServerProductName(v string) bool {
v = strings.TrimSpace(v)
if v == "" {
return false
}
n := strings.ToUpper(v)
if strings.Contains(n, "NULL") {
return false
}
componentTokens := []string{
"DIMM", "DDR", "NVME", "SSD", "HDD", "GPU", "NIC", "RAID",
"PSU", "FAN", "BACKPLANE", "FRU",
}
for _, token := range componentTokens {
if strings.Contains(n, strings.ToUpper(token)) {
return false
}
}
return true
}
type redfishSnapshotReader struct {
tree map[string]interface{}
}
@@ -918,7 +942,7 @@ func (r redfishSnapshotReader) collectGPUs(systemPaths, chassisPaths []string) [
out = append(out, gpu)
}
}
return out
return dropModelOnlyGPUPlaceholders(out)
}
func (r redfishSnapshotReader) collectPCIeDevices(systemPaths, chassisPaths []string) []models.PCIeDevice {