Skip to content

host-sp-comms inventory probably should have a separate error code for bad device _contents_ #2249

@hawkw

Description

@hawkw

IPCC inventory lookups return the following error codes:

pub enum InventoryDataResult {
Ok,
/// The given index is larger than our device count
InvalidIndex,
/// Communication with the device failed in a way that suggests its absence
DeviceAbsent,
/// Communication with the device failed in some other way
DeviceFailed,
/// Failed to serialize data
SerializationError,
}

Presently, DeviceFailed is what the SP will return when reading VPD from a device if the device returns an error, or if the data read from the device is malformed or corrupted. For example:

// extract barcode!
let identity = oxide_barcode::VpdIdentity::parse(&barcode[..n])
.map_err(|_| InventoryDataResult::DeviceFailed)?;
Ok(identity)

While testing #2229, @citrus-it and I saw that the host software will map the DeviceFailed result (code 3) to EIO, so it gets presented as an "I/O error":

gimlet-sn06 # ipcc inventory 0x48
metadata:
    version: 0x0
    entries: 0x49
J180/ID (72) -- Result: 3 [I/O error]

This doesn't feel quite right to me. I think we should introduce a new error code to represent "we read something from the device, but it didn't parse, had an invalid checksum, or an expected TLV-c tag was not present". Of course, adding new messages to the protocol will require coordination with the host side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions