fix(topology): attach HPE DIMMs and RAID member disks; import easy-bee event logs

HPE DL380 Gen11 BEE-SP v14.23 blackbox bundle (ADL-077):
- topology: accept "PROC n" DIMM locators, show the storage controller
  filtered from the export by ADL-062 when disks resolve to it, resolve
  storcli EID:Slt drives via VD -> OS drive -> controller BDF, hide BMC VGA,
  label numeric PSU slots "PSU n"
- easy_bee: parse SEL / dmesg -T event times, keep message_id and
  component_ref, pass platform_config through
- exporter: map ipmi-sel -> bmc and dmesg/kernel -> host in event_logs
- privacy: treat journald/syslog kernel lines as noise (linux.it false positive)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikhail ChusavitinandClaude Opus 5.5 committed 2026-10-01 12:49:08 +03:00
1 parent 9f5f7a98be
commit ff5b99fa5c
15 files changed
+333 -26

No files matched your search

+1
View File
@@ -42,6 +42,7 @@ hardware.network_adapters
hardware.network_cards
hardware.power_supplies
hardware.firmware
hardware.platform_config
```
`network_cards` is legacy/alternate source data.
+1 -1
View File
@@ -59,7 +59,7 @@ serial from its socket, model, board serial, or another component; reject source
| Vendor ID | Input family | Notes |
|-----------|--------------|-------|
| `dell` | TSR ZIP archives | Broad hardware, firmware, sensors, lifecycle events |
| `easy_bee` | `bee-support-*.tar.gz` | Imports the embedded hardware snapshot and static DIMM/storage/NVIDIA evidence used to build `topology.json`; without `bee-audit.json` (audit unfinished at capture) falls back to the bundled `nvidia-bug-report.txt` (ADL-076) |
| `easy_bee` | `bee-support-*.tar.gz`, blackbox `.zip` | Imports the embedded hardware snapshot (inventory, `event_logs` with source-native SEL/dmesg timestamps, `platform_config`) and static DIMM/storage/storcli/NVIDIA evidence used to build `topology.json` (ADL-077); without `bee-audit.json` (audit unfinished at capture) falls back to the bundled `nvidia-bug-report.txt` (ADL-076) |
| `h3c_g5` | H3C SDS G5 bundles | INI/XML/CSV-driven hardware and event parsing |
| `h3c_g6` | H3C SDS G6 bundles | Similar flow with G6-specific files |
| `hpe_ilo_ahs` | HPE iLO Active Health System (`.ahs`) | Proprietary `ABJR` container with gzip-compressed `zbb` members; parser combines SMBIOS-style inventory strings and embedded Redfish storage JSON |
+39
View File
@@ -2233,3 +2233,42 @@ message.
sensors and firmware are absent because they exist only in the audit snapshot.
- The root cause is on the collection side: bee-support should wait for `bee-audit.service`
(or mark the bundle as incomplete), and the R7715 `ipmitool sensor` stall needs a timeout.
## ADL-077 — Topology shows the storage controller behind RAID member disks; easy-bee event logs and platform_config are imported
**Date:** 2026-10-01
**Context:** BEE-SP v14.23 blackbox bundle of an HPE ProLiant DL380 Gen11 (CZ2D2Q07DQ): one CPU,
one DIMM, a MegaRAID (MR408i-o) with a RAID1 of two NVMe drives. The topology page showed the DIMM
and both disks under "Other / no socket affinity", no RAID controller, and the iLO Matrox VGA as a
"GPU". Causes: HPE DIMM locators read `PROC 1 DIMM 10`, not `CPU1_…`; the controller is dropped
from `pcie_devices` by ADL-062 (no serial/part number), so `topology.Build` never saw it; RAID
member drives carry the storcli `EID:Slt` slot (`252:1`), while `storage-controllers.txt` only
maps OS block devices by HCTL. Separately, all 402 snapshot `event_logs` were lost on export
(sources `ipmi-sel`/`dmesg` unmapped, timestamps unparsed) and `platform_config` was never read.
**Decision:**
- `topology.Build` additionally receives the controllers ADL-062 filters out
(`exporter.OnboardControllersForTopology`). Such a controller becomes a node only when a disk
resolves to it; the Reanimator export itself is unchanged.
- A storcli physical drive resolves to its controller through static evidence only:
PD → virtual drive (`storcli64-vds.json`) → `OS Drive Name` → `storage-controllers.txt` → BDF.
Drives outside any VD (`storcli64-drives.json`) inherit the BDF their controller index got from
a sibling VD.
- The DIMM socket locator accepts `PROC n` / `Processor n` next to `CPU n`.
- A video-class function with a BMC VGA vendor ID (Matrox `102b`, ASPEED `1a03`) is not a
topology node. A numeric PSU slot is labelled `PSU n`.
- `easy_bee` parses the source-native `event_time` strings bee passes through (ipmitool SEL
`MM/DD/YY hh:mm:ss UTC`, `dmesg -T`); a SEL `Pre-Init <ticks>` record stays undated (ADL-070).
`message_id` and `component_ref` are kept. The exporter maps `ipmi-sel` → `bmc` and
`dmesg`/`kernel` → `host`. The snapshot's `is_active` is not imported: it is bee's
latest-record-per-sensor guess, not an active-alarm snapshot (ADL-072).
- `hardware.platform_config` is added to `HardwareConfig` and passed through to the export
unchanged; `easy_bee` is the first source.
- Privacy scan treats journald/syslog `… kernel: …` lines as kernel noise like `[ 12.34] …`
lines (the `pps_core … <giometti@linux.it>` copyright was reported as customer `linux.it`).
**Consequences:**
- The bundle renders CPU 1 → Memory, NIC ×4, RAID → Storage ×2, with no "Other" block.
- The MegaRAID is still absent from the exported `pcie_devices` (ADL-062 stands); a controller
with no VD and no HCTL-mapped disk stays invisible in the topology too.
- Bee runtime/service/interface state events remain UI-only (no contract source).
+2 -1
View File
@@ -57,7 +57,8 @@ via `parser.PrivacyScanEnabled()`.
- **Clean-token boundary**: an FQDN glued to surrounding identifier chars
(`auth.backend.gssapi.store-creds`) or Title-cased (`OS.It`) is a code
fragment, not a host.
- Kernel ring-buffer lines (`[ 8.07]...`, `[ 8.07][ T1]...`) and Go
- Kernel ring-buffer lines (`[ 8.07]...`, `[ 8.07][ T1]...`), the same
messages in journald/syslog form (`Oct 01 09:32:18 host kernel: ...`) and Go
stack-trace lines (`/go-mod/`, `file.go:123`) are skipped for FQDN/email.
- `resolv` `domain`/`search` values must contain a dot.
- IPv4: skipped on `#`/`;` comment lines and version/spec-clause lines
+23 -3
View File
@@ -52,6 +52,7 @@ func ConvertToReanimator(result *models.AnalysisResult) (*ReanimatorExport, erro
PowerSupplies: disambiguatePSUSlots(dedupePSUs(convertPSUsFromDevices(devices, collectedAt))),
Sensors: convertSensors(result.Sensors),
EventLogs: convertEventLogs(result.Events),
PlatformConfig: result.Hardware.PlatformConfig,
Licenses: dedupeLicenses(convertLicenses(result.Hardware.Licenses, collectedAt)),
},
}
@@ -984,6 +985,25 @@ func convertStorageFromDevices(devices []models.HardwareDevice, collectedAt stri
}
func convertPCIeFromDevices(devices []models.HardwareDevice, collectedAt string) []ReanimatorPCIe {
return convertPCIeDevicesWhere(devices, collectedAt, func(d models.HardwareDevice) bool {
return !isOnboardControllerPCIeDevice(d)
})
}
// OnboardControllersForTopology returns the PCIe storage/switch controllers that
// ConvertToReanimator deliberately leaves out of pcie_devices (ADL-062). They
// are not inventory, but the topology view still needs them as the parents of
// the disks behind them. Call it after ConvertToReanimator, which populates
// the canonical device list.
func OnboardControllersForTopology(result *models.AnalysisResult) []ReanimatorPCIe {
if result == nil || result.Hardware == nil {
return nil
}
collectedAt := formatRFC3339(reanimatorCollectedAt(result))
return dedupePCIe(convertPCIeDevicesWhere(result.Hardware.Devices, collectedAt, isOnboardControllerPCIeDevice))
}
func convertPCIeDevicesWhere(devices []models.HardwareDevice, collectedAt string, keep func(models.HardwareDevice) bool) []ReanimatorPCIe {
result := make([]ReanimatorPCIe, 0)
for _, d := range devices {
if d.Kind != models.DeviceKindPCIe && d.Kind != models.DeviceKindGPU && d.Kind != models.DeviceKindNetwork {
@@ -992,7 +1012,7 @@ func convertPCIeFromDevices(devices []models.HardwareDevice, collectedAt string)
if isStorageEndpointPCIeDevice(d) {
continue
}
if isOnboardControllerPCIeDevice(d) {
if !keep(d) {
continue
}
if isPlaceholderPCIeExportDevice(d) {
@@ -1474,9 +1494,9 @@ func normalizeEventLogSource(source string) string {
switch strings.ToLower(strings.TrimSpace(source)) {
case "redfish":
return "redfish"
case "sel", "bmc", "ipmi", "idrac", "lifecycle controller", "lifecyclecontroller", "hpe ilo", "ilo":
case "sel", "ipmi-sel", "bmc", "ipmi", "idrac", "lifecycle controller", "lifecyclecontroller", "hpe ilo", "ilo":
return "bmc"
case "system", "syslog", "smart", "zfs", "file", "gpu", "dmi", "nvidia driver", "gpu field diagnostics", "fan", "memory", "host":
case "system", "syslog", "dmesg", "kernel", "smart", "zfs", "file", "gpu", "dmi", "nvidia driver", "gpu field diagnostics", "fan", "memory", "host":
return "host"
default:
return ""
@@ -48,3 +48,14 @@ func TestConvertEventLogs_IsActive(t *testing.T) {
}
func ptrBool(v bool) *bool { return &v }
func TestConvertEventLogs_EasyBeeSources(t *testing.T) {
logs := convertEventLogs([]models.Event{
{Source: "ipmi-sel", Description: "Transition to Non-critical from OK"},
{Source: "dmesg", Description: "usb 1-1: device not accepting address 3, error -71"},
{Source: "Bee Runtime", Description: "Bee runtime status: PARTIAL"},
})
if len(logs) != 2 || logs[0].Source != "bmc" || logs[1].Source != "host" {
t.Fatalf("unexpected event_logs: %+v", logs)
}
}
+3
View File
@@ -166,6 +166,9 @@ type HardwareConfig struct {
PowerSupply []PSU `json:"power_supplies,omitempty"`
Licenses []License `json:"licenses,omitempty"`
HGX *HGXIdentity `json:"hgx,omitempty"`
// PlatformConfig carries platform settings exactly as the source reports
// them (TPM/BIOS key-value pairs); passed through to the Reanimator export.
PlatformConfig map[string]any `json:"platform_config,omitempty"`
}
// HGXAssemblyIdentity is the Model/PartNumber/SerialNumber triple for one
+2
View File
@@ -6,6 +6,8 @@ package models
type TopologyEvidence struct {
DIMMType17 string
StorageMap string
StorcliVDs string
StorcliDrives string
NVIDIAQueryCSV string
NVIDIATopology string
NVLinkStatus string
+16 -6
View File
@@ -11,7 +11,7 @@ import (
"git.mchus.pro/mchus/logpile/internal/parser"
)
const parserVersion = "1.2"
const parserVersion = "1.3"
func init() {
parser.Register(&Parser{})
@@ -124,6 +124,7 @@ func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, er
NetworkCards: append([]models.NIC(nil), snapshot.Hardware.NetworkCards...),
NetworkAdapters: normalizeNetworkAdapters(snapshot.Hardware.NetworkAdapters),
PowerSupply: normalizePSUSlots(snapshot.Hardware.PowerSupply),
PlatformConfig: snapshot.Hardware.PlatformConfig,
},
}
result.TopologyEvidence = collectTopologyEvidence(files)
@@ -171,6 +172,8 @@ func collectTopologyEvidence(files []parser.ExtractedFile) *models.TopologyEvide
e := &models.TopologyEvidence{
DIMMType17: read("dmidecode-type17.txt"),
StorageMap: read("storage-controllers.txt"),
StorcliVDs: read("storcli64-vds.json"),
StorcliDrives: read("storcli64-drives.json"),
NVIDIAQueryCSV: read("nvidia-smi-query-fresh.csv", "nvidia-smi-query.csv"),
NVIDIATopology: read("nvidia-smi-topo-fresh.txt", "nvidia-smi-topo.txt"),
NVLinkStatus: read("nvidia-smi-nvlink-status-fresh.txt", "nvidia-smi-nvlink-status.txt"),
@@ -220,6 +223,7 @@ type beeHardware struct {
PowerSupply []models.PSU `json:"power_supplies,omitempty"`
Sensors beeSensorGroups `json:"sensors,omitempty"`
EventLogs []beeEventLog `json:"event_logs,omitempty"`
PlatformConfig map[string]any `json:"platform_config,omitempty"`
}
type beeSensorGroups struct {
@@ -295,6 +299,7 @@ type beeEventLog struct {
Severity string `json:"severity,omitempty"`
MessageID string `json:"message_id,omitempty"`
Message string `json:"message,omitempty"`
ComponentRef string `json:"component_ref,omitempty"`
RawPayload map[string]any `json:"raw_payload,omitempty"`
}
@@ -441,15 +446,16 @@ func convertEventLogs(items []beeEventLog) []models.Event {
if message == "" {
continue
}
ts := parseEventTime(item.EventTime)
rawData := strings.TrimSpace(item.MessageID)
// The snapshot's is_active is bee's own "latest record per sensor"
// guess, not an active-alarm snapshot, so it is not imported (ADL-072).
events = append(events, models.Event{
Timestamp: ts,
ID: strings.TrimSpace(item.MessageID),
Timestamp: parseEventTime(item.EventTime),
Source: firstNonEmpty(strings.TrimSpace(item.Source), "Reanimator"),
SensorName: strings.TrimSpace(item.ComponentRef),
EventType: "Event Log",
Severity: mapSeverity(item.Severity),
Description: message,
RawData: rawData,
})
}
return events
@@ -460,7 +466,11 @@ func parseEventTime(raw string) time.Time {
if raw == "" {
return time.Time{}
}
layouts := []string{time.RFC3339Nano, time.RFC3339}
// Besides RFC3339, bee passes source-native stamps through unchanged:
// ipmitool SEL ("10/01/26 09:34:07 UTC") and `dmesg -T`
// ("Thu Oct 1 09:32:18 2026"). A SEL "Pre-Init <ticks>" stamp carries no
// wall-clock time and stays zero.
layouts := []string{time.RFC3339Nano, time.RFC3339, "01/02/06 15:04:05 MST", "01/02/2006 15:04:05 MST", time.ANSIC}
for _, layout := range layouts {
if ts, err := time.Parse(layout, raw); err == nil {
return ts.UTC()
+25
View File
@@ -293,3 +293,28 @@ func TestNormalizePSUSlots(t *testing.T) {
t.Errorf("non-numeric slot must be untouched, got %q", got[0].Slot)
}
}
// Real BEE-SP v14.23 event_logs pass the source-native timestamps through:
// ipmitool SEL, `dmesg -T`, and SEL "Pre-Init" records with no wall-clock time.
func TestConvertEventLogsParsesSourceNativeTimes(t *testing.T) {
events := convertEventLogs([]beeEventLog{
{Source: "ipmi-sel", EventTime: "04/01/25 18:59:45 UTC", Severity: "Critical", MessageID: "6", Message: "Transition to Non-recoverable from less severe", ComponentRef: "Chassis #0xac"},
{Source: "dmesg", EventTime: "Thu Oct 1 09:33:18 2026", Severity: "Critical", Message: "usb 1-1: device not accepting address 3, error -71"},
{Source: "ipmi-sel", EventTime: "Pre-Init 0000000270", Severity: "info", MessageID: "1", Message: "S0/G0: working"},
})
if len(events) != 3 {
t.Fatalf("expected 3 events, got %d", len(events))
}
if want := time.Date(2025, 4, 1, 18, 59, 45, 0, time.UTC); !events[0].Timestamp.Equal(want) {
t.Errorf("SEL time = %v, want %v", events[0].Timestamp, want)
}
if events[0].ID != "6" || events[0].SensorName != "Chassis #0xac" || events[0].Severity != models.SeverityCritical {
t.Errorf("SEL event fields lost: %+v", events[0])
}
if want := time.Date(2026, 10, 1, 9, 33, 18, 0, time.UTC); !events[1].Timestamp.Equal(want) {
t.Errorf("dmesg time = %v, want %v", events[1].Timestamp, want)
}
if !events[2].Timestamp.IsZero() {
t.Errorf("Pre-Init SEL record must stay undated, got %v", events[2].Timestamp)
}
}
+1
View File
@@ -171,6 +171,7 @@ func TestScan_OSConfigNoise(t *testing.T) {
`serial-getty@ttyAMA0.service`,
`Copyright (C) 2002-22, www.smartmontools.org`,
`OpenIB.org BSD license (FreeBSD Variant)`,
`Oct 01 09:32:18 easy-bee-nogpu-v14-23 kernel: pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>`,
}, "\n")
rep := Scan([]File{{Path: "onekeylog/log/sollog/SOLHostCapture.log", Content: []byte(noise)}})
if rep != nil && len(rep.Findings) > 0 {
+4 -1
View File
@@ -77,6 +77,9 @@ var (
// Kernel ring-buffer line: "[ 12.345678] ..." or "[ 12.34][ T1] ...".
// These carry driver/copyright strings (emails, versions), never customer id.
reKernelTimestamp = regexp.MustCompile(`^\[\s*\d+\.\d+\]`)
// The same kernel messages as journald/syslog renders them:
// "Oct 01 09:32:18 host kernel: pps_core: ... <giometti@linux.it>".
reSyslogKernel = regexp.MustCompile(`^(?:\S+\s+){1,5}kernel:\s`)
// Go panic / stack-trace lines: module-cache paths and "file.go:123" frames.
reGoRuntime = regexp.MustCompile(`/go-mod/|\bgoroutine \d|\.go:\d+`)
// A dotted quad sitting on a line that is talking about a version or a spec
@@ -123,7 +126,7 @@ var (
func findMatches(line string, certFile bool) []matchSpan {
var out []matchSpan
specific := map[string]struct{}{}
noiseLine := reKernelTimestamp.MatchString(line) || reGoRuntime.MatchString(line)
noiseLine := reKernelTimestamp.MatchString(line) || reSyslogKernel.MatchString(line) || reGoRuntime.MatchString(line)
add := func(cat, sev, hint string, s, e int) {
if s < 0 || e > len(line) || s >= e {
+1 -1
View File
@@ -17,7 +17,7 @@ func currentTopologyDocument(result *models.AnalysisResult) (*models.TopologyDoc
if err != nil {
return nil, err
}
return topology.Build(snapshot, result.TopologyEvidence), nil
return topology.Build(snapshot, result.TopologyEvidence, exporter.OnboardControllersForTopology(result)...), nil
}
func (s *Server) handleTopologyCurrent(w http.ResponseWriter, r *http.Request) {
+143 -13
View File
@@ -1,6 +1,7 @@
package topology
import (
"encoding/json"
"fmt"
"regexp"
"sort"
@@ -14,15 +15,22 @@ import (
const ContractVersion = "1.0"
var (
cpuLocatorRE = regexp.MustCompile(`(?i)(?:^|[_ -])cpu\s*0*(\d+)`)
cpuLocatorRE = regexp.MustCompile(`(?i)(?:^|[_ -])(?:cpu|proc(?:essor)?)\s*0*(\d+)`)
bankNodeRE = regexp.MustCompile(`(?i)node\s*0*(\d+)`)
nvLinkRE = regexp.MustCompile(`(?i)^NV(\d+)$`)
storcliVDRE = regexp.MustCompile(`^PDs for VD (\d+)$`)
storcliPDRE = regexp.MustCompile(`^Drive /c(\d+)/e\d+/s\d+$`)
)
// PCI vendor IDs of BMC-embedded VGA functions (Matrox G200e*, ASPEED AST*).
var bmcVideoVendorIDs = map[int]bool{0x102b: true, 0x1a03: true}
// Build creates the standalone topology.json document from the same
// normalized projection used by the chart, augmented by optional static Bee
// support-bundle evidence. It never executes commands or reads live state.
func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidence) *models.TopologyDocument {
// controllers are the onboard storage controllers the Reanimator projection
// omits; one becomes a node only when a disk resolves to it.
func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidence, controllers ...exporter.ReanimatorPCIe) *models.TopologyDocument {
doc := &models.TopologyDocument{Version: ContractVersion}
if snapshot == nil {
return doc
@@ -44,15 +52,30 @@ func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidenc
socketByCPU = append(socketByCPU, socket)
}
numaToCPU := buildNUMAMap(hw.PCIeDevices, cpuIDs, socketByCPU)
diskController := resolveDiskControllers(evidence)
pcieDevices := append([]exporter.ReanimatorPCIe(nil), hw.PCIeDevices...)
for _, ctrl := range controllers {
bdf := normalizeBDF(firstNonEmpty(ctrl.Slot, ctrl.BDF))
for _, disk := range hw.Storage {
if bdf != "" && diskController[strings.TrimSpace(disk.Slot)] == bdf {
pcieDevices = append(pcieDevices, ctrl)
break
}
}
}
numaToCPU := buildNUMAMap(pcieDevices, cpuIDs, socketByCPU)
bdfToNode := map[string]string{}
gpuNodeByBDF := map[string]string{}
for i, dev := range hw.PCIeDevices {
for i, dev := range pcieDevices {
kind := pcieKind(dev)
if kind == "" {
continue
}
bdf := normalizeBDF(firstNonEmpty(dev.Slot, dev.BDF))
if bdfToNode[bdf] != "" {
continue
}
id := fmt.Sprintf("%s:%s", kind, bdf)
if bdf == "" {
id = fmt.Sprintf("%s:%d", kind, i)
@@ -87,14 +110,13 @@ func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidenc
}
}
controllerByHCTL := parseStorageMap(evidenceString(evidence, func(e *models.TopologyEvidence) string { return e.StorageMap }))
for i, disk := range hw.Storage {
id := fmt.Sprintf("storage:%s", strings.TrimSpace(disk.Slot))
if strings.TrimSpace(disk.Slot) == "" || containsNode(doc.Nodes, id) {
id = fmt.Sprintf("storage:%d", i)
}
doc.Nodes = append(doc.Nodes, models.TopologyNode{ID: id, Kind: "storage", Label: firstNonEmpty(disk.Type, "Disk"), Model: disk.Model, Status: disk.Status})
if controller := bdfToNode[controllerByHCTL[strings.TrimSpace(disk.Slot)]]; controller != "" {
if controller := bdfToNode[diskController[strings.TrimSpace(disk.Slot)]]; controller != "" {
doc.Edges = append(doc.Edges, models.TopologyEdge{From: controller, To: id, Kind: "storage"})
}
}
@@ -103,6 +125,8 @@ func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidenc
label := strings.TrimSpace(psu.Slot)
if label == "" {
label = fmt.Sprintf("PSU %d", i+1)
} else if _, err := strconv.Atoi(label); err == nil {
label = "PSU " + label
}
doc.Nodes = append(doc.Nodes, models.TopologyNode{ID: fmt.Sprintf("psu:%d", i), Kind: "psu", Label: label, Model: psu.Model, Status: psu.Status, WattageW: psu.WattageW})
}
@@ -166,8 +190,12 @@ func buildNUMAMap(devices []exporter.ReanimatorPCIe, cpuIDs []string, sockets []
func pcieKind(d exporter.ReanimatorPCIe) string {
c := strings.ToLower(strings.TrimSpace(d.DeviceClass))
model := strings.ToLower(d.Model + " " + d.Manufacturer)
video := strings.Contains(c, "video") || strings.Contains(c, "display")
switch {
case strings.Contains(c, "video"), strings.Contains(c, "display"), strings.Contains(c, "3d"), strings.Contains(c, "processingaccelerator"), strings.Contains(model, "nvidia") && strings.Contains(model, "gpu"):
case video && bmcVideoVendorIDs[d.VendorID]:
// The BMC's own VGA function is not a GPU of the server.
return ""
case video, strings.Contains(c, "3d"), strings.Contains(c, "processingaccelerator"), strings.Contains(model, "nvidia") && strings.Contains(model, "gpu"):
return "gpu"
case strings.Contains(c, "network"), strings.Contains(c, "ethernet"), strings.Contains(c, "fibrechannel"), len(d.MACAddresses) > 0:
return "nic"
@@ -253,11 +281,107 @@ func memoryCPU(node int, cpuIDs []string, sockets []int) string {
return ""
}
func parseStorageMap(raw string) map[string]string {
out := map[string]string{}
// resolveDiskControllers maps a storage slot to the BDF of its controller.
// Directly attached disks are keyed by SCSI HCTL. Physical drives behind a
// RAID controller have no block device of their own, so their storcli
// "EID:Slt" slot is resolved through the virtual drive they belong to:
// PD -> VD -> "OS Drive Name" -> block device -> controller.
func resolveDiskControllers(evidence *models.TopologyEvidence) map[string]string {
if evidence == nil {
return map[string]string{}
}
out, byBlockDev := parseStorageMap(evidence.StorageMap)
byStorcliCtrl := map[int]string{}
for _, ctrl := range storcliControllers(evidence.StorcliVDs) {
for key, raw := range ctrl.data {
m := storcliVDRE.FindStringSubmatch(key)
if m == nil {
continue
}
var props map[string]any
_ = json.Unmarshal(ctrl.data["VD"+m[1]+" Properties"], &props)
osDrive, _ := props["OS Drive Name"].(string)
bdf := byBlockDev[strings.TrimPrefix(strings.TrimSpace(osDrive), "/dev/")]
if bdf == "" {
continue
}
byStorcliCtrl[ctrl.index] = bdf
for _, slot := range storcliSlots(raw) {
if out[slot] == "" {
out[slot] = bdf
}
}
}
}
// Drives outside any virtual drive (unconfigured, JBOD, spare) still sit on
// a controller whose BDF a sibling virtual drive has revealed.
for _, ctrl := range storcliControllers(evidence.StorcliDrives) {
for key, raw := range ctrl.data {
m := storcliPDRE.FindStringSubmatch(key)
if m == nil {
continue
}
index, _ := strconv.Atoi(m[1])
bdf := byStorcliCtrl[index]
if bdf == "" {
continue
}
for _, slot := range storcliSlots(raw) {
if out[slot] == "" {
out[slot] = bdf
}
}
}
}
return out
}
type storcliController struct {
index int
data map[string]json.RawMessage
}
func storcliControllers(raw string) []storcliController {
var doc struct {
Controllers []struct {
Status struct {
Controller int `json:"Controller"`
} `json:"Command Status"`
Data map[string]json.RawMessage `json:"Response Data"`
} `json:"Controllers"`
}
if strings.TrimSpace(raw) == "" || json.Unmarshal([]byte(raw), &doc) != nil {
return nil
}
out := make([]storcliController, 0, len(doc.Controllers))
for _, c := range doc.Controllers {
out = append(out, storcliController{index: c.Status.Controller, data: c.Data})
}
return out
}
func storcliSlots(raw json.RawMessage) []string {
var rows []map[string]any
if json.Unmarshal(raw, &rows) != nil {
return nil
}
var out []string
for _, row := range rows {
if slot, _ := row["EID:Slt"].(string); strings.TrimSpace(slot) != "" {
out = append(out, strings.TrimSpace(slot))
}
}
return out
}
// parseStorageMap reads "sda hctl=0:3:111:0 ctrl=0000:6d:00.0" lines into
// controller BDFs keyed by HCTL and by block device name.
func parseStorageMap(raw string) (byHCTL, byBlockDev map[string]string) {
byHCTL, byBlockDev = map[string]string{}, map[string]string{}
for _, line := range strings.Split(raw, "\n") {
hctl, ctrl := "", ""
for _, field := range strings.Fields(line) {
fields := strings.Fields(line)
for _, field := range fields {
if v, ok := strings.CutPrefix(field, "hctl="); ok {
hctl = v
}
@@ -265,11 +389,17 @@ func parseStorageMap(raw string) map[string]string {
ctrl = normalizeBDF(v)
}
}
if hctl != "" && ctrl != "" {
out[hctl] = ctrl
if ctrl == "" {
continue
}
if hctl != "" {
byHCTL[hctl] = ctrl
}
if !strings.Contains(fields[0], "=") {
byBlockDev[fields[0]] = ctrl
}
}
return out
return byHCTL, byBlockDev
}
func addNVLinkEdges(doc *models.TopologyDocument, evidence *models.TopologyEvidence, gpuByBDF map[string]string) {
+61
View File
@@ -82,3 +82,64 @@ func TestRenderHTMLIsStaticAndEscapesLabels(t *testing.T) {
}
}
}
// HPE ProLiant DL380 Gen11 (BEE-SP v14.23): DIMM locators read "PROC 1 DIMM 10",
// the MegaRAID controller is not part of the Reanimator projection, and its
// physical drives carry storcli "EID:Slt" slots instead of an HCTL.
func TestBuildAttachesHPEMemoryAndRAIDMemberDisks(t *testing.T) {
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
Board: exporter.ReanimatorBoard{SerialNumber: "SN1"},
CPUs: []exporter.ReanimatorCPU{{Socket: 1}},
Memory: []exporter.ReanimatorMemory{{Slot: "PROC 1 DIMM 10", SizeMB: 32768}},
Storage: []exporter.ReanimatorStorage{
{Slot: "252:1", Model: "Micron_7450"},
{Slot: "252:2", Model: "Micron_7450"},
{Slot: "252:3", Model: "Micron_7450"},
},
PCIeDevices: []exporter.ReanimatorPCIe{
{Slot: "0000:01:00.1", VendorID: 0x102b, DeviceClass: "VideoController", Model: "MGA G200eH3", NUMANode: intp(0)},
{Slot: "0000:6c:00.0", DeviceClass: "NetworkController", NUMANode: intp(0)},
},
}}
e := &models.TopologyEvidence{
StorageMap: "sda hctl=0:3:111:0 ctrl=0000:6d:00.0\nsdb hctl=1:0:0:0 ctrl=0000:00:14.0\n",
StorcliVDs: `{"Controllers":[{"Command Status":{"Controller":0},"Response Data":{
"/c0/v239":[{"DG/VD":"0/239","TYPE":"RAID1"}],
"PDs for VD 239":[{"EID:Slt":"252:1"},{"EID:Slt":"252:2"}],
"VD239 Properties":{"OS Drive Name":"/dev/sda"}}}]}`,
StorcliDrives: `{"Controllers":[{"Command Status":{"Controller":0},"Response Data":{
"Drive /c0/e252/s1":[{"EID:Slt":"252:1"}],
"Drive /c0/e252/s3":[{"EID:Slt":"252:3"}],
"Drive /c0/e252/s3 - Detailed Information":{}}}]}`,
}
controllers := []exporter.ReanimatorPCIe{
{Slot: "0000:6d:00.0", DeviceClass: "MassStorageController", Model: "MegaRAID", NUMANode: intp(0)},
{Slot: "0000:00:17.0", DeviceClass: "SATAController", Model: "AHCI", NUMANode: intp(0)},
}
doc := Build(snapshot, e, controllers...)
edges := map[string]string{}
for _, edge := range doc.Edges {
edges[edge.To] = edge.From
}
want := map[string]string{
"memory:PROC 1 DIMM 10": "cpu:1",
"raid:0000:6d:00.0": "cpu:1",
"storage:252:1": "raid:0000:6d:00.0",
"storage:252:2": "raid:0000:6d:00.0",
"storage:252:3": "raid:0000:6d:00.0",
}
for to, from := range want {
if edges[to] != from {
t.Errorf("edge to %s: got from %q, want %q", to, edges[to], from)
}
}
for _, n := range doc.Nodes {
if n.Kind == "gpu" {
t.Errorf("BMC VGA rendered as a GPU: %+v", n)
}
if n.BDF == "0000:00:17.0" {
t.Errorf("diskless onboard controller must stay hidden: %+v", n)
}
}
}