Expand Redfish storage fallback for enclosure Disk.Bay paths

This commit is contained in:
Mikhail Chusavitin
2026-02-24 18:25:00 +03:00
parent 144d298efa
commit 7a1285db99
2 changed files with 92 additions and 13 deletions
+26 -1
View File
@@ -208,6 +208,11 @@ func (r redfishSnapshotReader) collectStorage(systemPath string) []models.Storag
for _, driveDoc := range driveDocs {
out = append(out, parseDrive(driveDoc))
}
if len(driveDocs) == 0 {
for _, driveDoc := range r.probeDirectDiskBayChildren(driveCollectionPath) {
out = append(out, parseDrive(driveDoc))
}
}
}
continue
}
@@ -233,6 +238,22 @@ func (r redfishSnapshotReader) collectStorage(systemPath string) []models.Storag
if looksLikeDrive(member) {
out = append(out, parseDrive(member))
}
for _, enclosurePath := range redfishLinkRefs(member, "Links", "Enclosures") {
driveDocs, err := r.getCollectionMembers(joinPath(enclosurePath, "/Drives"))
if err == nil {
for _, driveDoc := range driveDocs {
if looksLikeDrive(driveDoc) {
out = append(out, parseDrive(driveDoc))
}
}
if len(driveDocs) == 0 {
for _, driveDoc := range r.probeDirectDiskBayChildren(joinPath(enclosurePath, "/Drives")) {
out = append(out, parseDrive(driveDoc))
}
}
}
}
}
simpleStorageMembers, _ := r.getCollectionMembers(joinPath(systemPath, "/SimpleStorage"))
@@ -278,8 +299,12 @@ func (r redfishSnapshotReader) collectStorage(systemPath string) []models.Storag
}
func (r redfishSnapshotReader) probeSupermicroNVMeDiskBays(backplanePath string) []map[string]interface{} {
return r.probeDirectDiskBayChildren(joinPath(backplanePath, "/Drives"))
}
func (r redfishSnapshotReader) probeDirectDiskBayChildren(drivesCollectionPath string) []map[string]interface{} {
var out []map[string]interface{}
for _, path := range supermicroNVMeDiskBayCandidates(backplanePath) {
for _, path := range directDiskBayCandidates(drivesCollectionPath) {
doc, err := r.getJSON(path)
if err != nil || !looksLikeDrive(doc) {
continue