tianocore / edk2-redfish-client

Utilizes the EFI protocols provided by EDK2 Redfish Foundation to communicate with the Redfish service for creating, consuming, and updating the Redfish properties which are managed by firmware.
Other
7 stars 5 forks source link

[Code] Error handling support and return error message in Messages object #16

Open nicklela opened 1 year ago

nicklela commented 1 year ago

Current feature driver has no ability to return error back to user. Redfish allow application to put error message in Message object. Below is an example

Image

Ref: Redfish spec. 1.15.1 chapter 8.6 Error responses: HTTP status codes often do not provide enough information to enable deterministic error semantics. .... Additionally, the service may provide Redfish standardized errors, OEMdefined errors, or both, depending on the implementation's ability to convey the most useful information about the underlying error.

Image

changab commented 1 year ago

Current feature driver has no ability to return error back to user

ok, I forget what was the conclusion. Return the message to BIOS if something is wrong when the Redfish operation? Such as PATCH a BIOS attribute with improper format?

nicklela commented 1 year ago

Current feature driver has no ability to return error back to use

ok, I forget what was the conclusion. Return the message to BIOS if something is wrong when the Redfish operation? Such as PATCH a BIOS attribute with improper format?

Yes, format is one thing BIOS can capture. Others like the typo or invalid value passing from user. One other error that is important to user is the dependency violation. So, like you said, BIOS needs to return error back to user while user makes changes to pending settings (/redfish/v1/..../Bios/Settings)

Depending on the BMC implementation, some validation can be done by BMC. For example, BMC can read BIOS attribute registry and learn the definition of BIOS attributes. So BMC can help to check typo, formating and value boundary. One BMC can do this, BMC can return error immediately to user with HTTP error status code. User does not need additional reset cycle to read error message. But BMC has to agree with this implementation. For OpenBMC, it means OpenBMC has to manage BIOS resource with internal data structure. This should be possible because OpenBMC has BIOS Table data structure (Ref: https://github.com/openbmc/bios-settings-mgr/blob/36cd3238d75c5f3479a944a2f1a9a3abc316120a/src/manager.cpp#L99)