Skip to content

Commit

Permalink
HW-Isolation: Fix Additional Data Uri
Browse files Browse the repository at this point in the history
The guard records could be associated with hidden or visible PEL. The
additional URI for visible pel would be
/redfish/v1/Systems/system/LogServices/EventLog/Entries/<id>/attachment
and for the hidden ones it has be
/redfish/v1/Systems/system/LogServices/CELog/Entries/<id>/attachment

So before adding the AdditionalDataURI, check for the hidden property of
the PEL and add the URI accordingly.

Tested and found it works as expected

```
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries",
  "@odata.type": "#LogEntryCollection.LogEntryCollection",
  "Description": "Collection of System Hardware Isolation Entries",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/1",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/CELog/Entries/824/attachment",
      "Created": "2025-01-23T12:57:02+00:00",
      "EntryType": "Event",
      "Id": "1",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/3",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/830/attachment",
      "Created": "2025-01-23T13:08:31+00:00",
      "EntryType": "Event",
      "Id": "3",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
}
```
  • Loading branch information
deepakala-k committed Jan 24, 2025
1 parent b83a314 commit 03e553c
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions redfish-core/lib/log_services.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7129,7 +7129,6 @@ inline void fillSystemHardwareIsolationLogEntry(

std::string guardType;

bool hiddenPEL = false;
// We need the severity details before getting the associations
// to fill the message details.
for (const auto& interface : dbusObjIt->second)
Expand Down Expand Up @@ -7161,7 +7160,6 @@ inline void fillSystemHardwareIsolationLogEntry(
"xyz.openbmc_project.HardwareIsolation.Entry.Type.Spare")
{
entryJson["Severity"] = "OK";
hiddenPEL = true;
}
}
}
Expand Down Expand Up @@ -7223,14 +7221,32 @@ inline void fillSystemHardwareIsolationLogEntry(
{
sdbusplus::message::object_path errPath =
std::get<2>(assoc);
std::string logPath = "EventLog";
if (hiddenPEL)
{
logPath = "CELog";
}
entryJson["AdditionalDataURI"] = boost::urls::format(
"/redfish/v1/Systems/system/LogServices/{}/Entries/{}/attachment",
logPath, errPath.filename());

std::string entryID = errPath.filename();

auto updateAdditionalDataURI = [asyncResp,
entryJsonIdx,
entryID](
bool hidden) {
nlohmann::json& entryJsonToupdateURI =
(entryJsonIdx > 0
? asyncResp->res
.jsonValue["Members"]
[entryJsonIdx - 1]
: asyncResp->res.jsonValue);
std::string logPath = "EventLog";

if (hidden)
{
logPath = "CELog";
}
entryJsonToupdateURI["AdditionalDataURI"] =
boost::urls::format(
"/redfish/v1/Systems/system/LogServices/{}/Entries/{}/attachment",
logPath, entryID);
};
getHiddenPropertyValue(asyncResp, entryID,
updateAdditionalDataURI);
}
}
}
Expand Down

0 comments on commit 03e553c

Please sign in to comment.