fix(redfish): narrow MSI PCIeFunctions crawl

This commit is contained in:
Mikhail Chusavitin
2026-04-01 16:50:51 +03:00
parent 475f6ac472
commit bb82387d48
4 changed files with 180 additions and 1 deletions
@@ -76,12 +76,17 @@ func (r redfishSnapshotReader) collectNICs(chassisPaths []string) []models.Netwo
}
for _, doc := range adapterDocs {
nic := parseNIC(doc)
adapterFunctionDocs := r.getNetworkAdapterFunctionDocs(doc)
for _, pciePath := range networkAdapterPCIeDevicePaths(doc) {
pcieDoc, err := r.getJSON(pciePath)
if err != nil {
continue
}
functionDocs := r.getLinkedPCIeFunctions(pcieDoc)
for _, adapterFnDoc := range adapterFunctionDocs {
functionDocs = append(functionDocs, r.getLinkedPCIeFunctions(adapterFnDoc)...)
}
functionDocs = dedupeJSONDocsByPath(functionDocs)
supplementalDocs := r.getLinkedSupplementalDocs(pcieDoc, "EnvironmentMetrics", "Metrics")
for _, fn := range functionDocs {
supplementalDocs = append(supplementalDocs, r.getLinkedSupplementalDocs(fn, "EnvironmentMetrics", "Metrics")...)
@@ -97,6 +102,22 @@ func (r redfishSnapshotReader) collectNICs(chassisPaths []string) []models.Netwo
return dedupeNetworkAdapters(nics)
}
func (r redfishSnapshotReader) getNetworkAdapterFunctionDocs(adapterDoc map[string]interface{}) []map[string]interface{} {
ndfCol, ok := adapterDoc["NetworkDeviceFunctions"].(map[string]interface{})
if !ok {
return nil
}
colPath := asString(ndfCol["@odata.id"])
if colPath == "" {
return nil
}
funcDocs, err := r.getCollectionMembers(colPath)
if err != nil {
return nil
}
return funcDocs
}
func (r redfishSnapshotReader) collectPCIeDevices(systemPaths, chassisPaths []string) []models.PCIeDevice {
collections := make([]string, 0, len(systemPaths)+len(chassisPaths))
for _, systemPath := range systemPaths {