feat(exporter): collect and export storage.vendor_id/device_id (contract v2.13)

Add PCI Vendor ID / Device ID to hardware.storage[] per the updated Reanimator
ingest contract, mirroring the existing pcie_devices[] fields. Populated for
Redfish-collected NVMe drives (live + TSR replay, via linked PCIeFunctions)
and for Inspur (from asset.json's own PcieInfo[], joined by PcieSlot). Also
fixes canonicalDevicesForExport dropping the fields when converting Storage
into the canonical HardwareDevice list used by the actual export path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-08-11 16:04:54 +03:00
co-authored by Claude Sonnet 5
parent 063587958e
commit 399eca5f49
11 changed files with 221 additions and 4 deletions
+42
View File
@@ -1445,3 +1445,45 @@ in it — other vendor parsers have no comparable source for this data yet.
- No other vendor parser populates `Hardware.Licenses` yet. If a future TSR/log source carries license
data outside a Redfish walk (e.g. embedded in a vendor-specific XML/JSON file), it needs its own
parsing — `collectLicenses()` only covers the generic Redfish `LicenseService` path.
## ADL-053 — Added `hardware.storage[].vendor_id`/`device_id` (contract v2.13)
**Date:** 2026-08-11
**Context:** Contract v2.13 added optional `vendor_id`/`device_id` (PCI Vendor ID / Device ID, decimal)
to `hardware.storage[]`, modeled on the existing `pcie_devices[].vendor_id`/`device_id` fields, for
NVMe drives whose numeric PCI IDs are known. Reanimator uses these to merge differently-worded model
strings for the same physical device into one registry entry, same as it already does for
`pcie_devices`. `bible-local/docs/hardware-ingest-contract.md` refreshed 2.12 → 2.13 from
`reanimator/core/bible-local/docs/hardware-ingest-contract.md`.
**Decision:**
- `models.Storage.VendorID`/`DeviceID` (int, `vendor_id`/`device_id,omitempty`) added
(`internal/models/models.go`), mirroring `models.PCIeDevice`/`models.HardwareDevice`.
- `exporter.ReanimatorStorage.VendorID`/`DeviceID` added; wired through both `convertStorage` (legacy
direct path) and `convertStorageFromDevices` (canonical-devices path, the one actually used by
`ConvertToReanimator`). The canonical-devices path required a second fix:
`canonicalDevicesForExport`'s `hw.Storage` → `HardwareDevice` conversion loop
(`reanimator_converter.go`, storage `appendDevice` call) wasn't copying `VendorID`/`DeviceID` onto the
`HardwareDevice` either — both hops needed the field, same failure shape as ADL-051's `Present` bug.
- Populated at collection time in two places that actually have PCI IDs for storage today:
- **Redfish collector** (`internal/collector/redfish.go` live path and
`internal/collector/redfish_replay_storage.go` snapshot-replay path, the one Dell iDRAC10 TSR
walks go through): `parseDriveWithSupplementalDocs` now reads `VendorId`/`DeviceId` off the drive
doc itself, then off any doc in `supplementalDocs` — every `collectStorage`/`collectStorage`
(replay) call site was updated to append the drive's linked `PCIeFunctions` doc(s)
(`getLinkedPCIeFunctions`) into `supplementalDocs`, same helper already used for GPU/NIC/PCIeDevice.
Reuses the existing generic `Links.PCIeFunctions` mechanism — no Drive-specific fetch added.
- **Inspur** (`internal/parser/vendors/inspur/asset.go`, `ParseAssetJSON`): `asset.json`'s own
`PcieInfo[]` array already carries `VendorId`/`DeviceId`/`PcieSlot` per entry; built a
`PcieSlot → (VendorID, DeviceID)` map from it and look it up by `hdd.PcieSlot` when building each
`Storage` entry — no new data source, same join key (`PcieSlot`) already used to enrich NVMe model
name/serial from `devicefrusdr.log`/`audit.log`.
- Other vendor parsers (Dell WSMAN/DCIM-XML path, h3c, lenovo_xcc, xigmanas) have no numeric PCI ID
source for storage today and were left unchanged. Unraid (`lspci -nn` output) and xfusion (`PCIe Card
Info` table) have numeric IDs in a sibling structure but no reliable join key back to the specific
storage entry yet — deferred, would need a new BDF↔block-device correlation mechanism.
**Consequences:**
- `go build ./...` and `go test ./...` clean. Added coverage: `TestParseComponentDetails_UseLinkedSupplementalMetrics`
(redfish_test.go, linked-PCIeFunction vendor/device ID extraction),
`TestParseAssetJSON_HddEnrichedWithPcieVendorDeviceID` (inspur), and
`TestConvertToReanimator_StorageVendorDeviceIDSurvivesRoundTrip` (exporter, full export→marshal→
reimport→re-export round trip).