Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW-Isolation: Fix Additional Data Uri #1128

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already defined above L7125?

    nlohmann::json& entryJson =
        (entryJsonIdx > 0
             ? asyncResp->res.jsonValue["Members"][entryJsonIdx - 1]
             : asyncResp->res.jsonValue);

If so, can L7243 be written as

                                entryJson["AdditionalDataURI"] =
                                    boost::urls::format(
                                        "/redfish/v1/Systems/system/LogServices/{}/Entries/{}/attachment",
                                        logPath, entryID);

Copy link
Contributor Author

@deepakala-k deepakala-k Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is within the asyn dbus callback. So by the time, the dbus call is successful with the hidden property value, it could have moved out the function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is within the asyn dbus callback. So by the time, the dbus call is successful with the hidden property value, it could have moved out the function

You're right. entryJson needs to be reset.
BTW, would this async callback be better to be a separate function?

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