From 03e553cd2b256117e2dc4f61438e13443556b07d Mon Sep 17 00:00:00 2001 From: Deepa Karthikeyan Date: Thu, 23 Jan 2025 07:42:53 -0600 Subject: [PATCH] HW-Isolation: Fix Additional Data Uri 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//attachment and for the hidden ones it has be /redfish/v1/Systems/system/LogServices/CELog/Entries//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" }, } ``` --- redfish-core/lib/log_services.hpp | 36 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index f567e547c..22ad558e2 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -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) @@ -7161,7 +7160,6 @@ inline void fillSystemHardwareIsolationLogEntry( "xyz.openbmc_project.HardwareIsolation.Entry.Type.Spare") { entryJson["Severity"] = "OK"; - hiddenPEL = true; } } } @@ -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); } } }