improve redfish collection progress and robust hardware dedup/serial parsing

This commit is contained in:
2026-02-28 16:07:42 +03:00
parent 8dbbec3610
commit 9a30705c9a
9 changed files with 871 additions and 60 deletions
+11 -13
View File
@@ -549,24 +549,19 @@ func (r redfishSnapshotReader) getCollectionMembers(collectionPath string) ([]ma
if err != nil {
return r.fallbackCollectionMembers(collectionPath, err)
}
refs, ok := collection["Members"].([]interface{})
if !ok || len(refs) == 0 {
memberPaths := redfishCollectionMemberRefs(collection)
if len(memberPaths) == 0 {
return r.fallbackCollectionMembers(collectionPath, nil)
}
out := make([]map[string]interface{}, 0, len(refs))
for _, refAny := range refs {
ref, ok := refAny.(map[string]interface{})
if !ok {
continue
}
memberPath := asString(ref["@odata.id"])
if memberPath == "" {
continue
}
out := make([]map[string]interface{}, 0, len(memberPaths))
for _, memberPath := range memberPaths {
doc, err := r.getJSON(memberPath)
if err != nil {
continue
}
if strings.TrimSpace(asString(doc["@odata.id"])) == "" {
doc["@odata.id"] = normalizeRedfishPath(memberPath)
}
out = append(out, doc)
}
if len(out) == 0 {
@@ -608,6 +603,9 @@ func (r redfishSnapshotReader) fallbackCollectionMembers(collectionPath string,
if err != nil {
continue
}
if strings.TrimSpace(asString(doc["@odata.id"])) == "" {
doc["@odata.id"] = normalizeRedfishPath(p)
}
out = append(out, doc)
}
return out, nil
@@ -939,7 +937,7 @@ func (r redfishSnapshotReader) collectGPUs(systemPaths, chassisPaths []string) [
if shouldSkipGenericGPUDuplicate(out, gpu) {
continue
}
key := gpuDedupKey(gpu)
key := gpuDocDedupKey(doc, gpu)
if key == "" {
continue
}