-
Notifications
You must be signed in to change notification settings - Fork 69
WIP: hw-isolation rebase: Added guard, deconfiguration, sparecore #1279
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
base: 1120
Are you sure you want to change the base?
Conversation
gcpin
commented
May 7, 2025
``` 1. Add support for guard, deconfiguration and sparecore 2. hw-isolation code relocation to systems_logservices_hwisolation.hpp Following commits from 1110 are used to create this unified commit 332c310 - redfish-core: LogServices: Added HardwareIsolation service 36dec57 - LogServices: HardwareIsolation: LogEntryCollection 3486c6a - LogServices: HardwareIsolation: Get LogEntry 3d981ef - LogServices: HardwareIsolation: Delete LogEntry 11e4cda - LogServices: HardwareIsolation: Post ClearLog 723c0fd - redfish-core: Core: Enabled the isolation feature e4cb163 - redfish-core: Memory:Enabled the isolation feature e2158ab - Core: Fix, Patch a core into the respective parent processor 4237af3 - Hw-Isolation: Deconfiguration type for DIMMs 21582d8 - Enabled deconfiguration reason support to the DIMM 558b32f - HW-Isolation: Fix, Don't throw internal error if failed to get error log 2ae01ea - HW-Isolation: Fix, Update State if the Core and DIMM are recovered 84aef9b - HW-Isolation: Return an appropriate error if the request is failed. 9ac66c5 - HW-Isolation: Return ResourceCannotBeDeleted error f769499 - LogService: HW-Isolation: Return an appropriate error c3839db - redfish-core: Core: Enabled the isolation (aka guard) feature 555fc6c - HW-Isolation: Fix, Use GetAncestors to get the parents id 2cf7c3f - HW-Isolation: Fill OriginOfCondition for the TPM and Motherboard 3bd202e - LogEntry: HW-Isolation: Removed the Resolved property 10ed043 - HardwareIsolation: Spare core support 5e53b61 - HW-Isolation: Fix info PEL AdditionalDataURI 50c9dc3 - HW-Isolation: Fix Additional Data Uri 7adcfa1 - Move getHiddenPropertyValue method to utils b90a99f - Hw-Isolation: Fix eventId HW Deconfiguration page ``` Signed-off-by: Gopichand Paturi <[email protected]> Co-authored-by: Ramesh Iyyar <[email protected]> Co-authored-by: deepakala k <[email protected]>
Can one of the admins verify this patch? |
add to approvelist |
asyncResp->res.jsonValue[errorLogPropPath]["@odata.id"] = | ||
boost::urls::format( | ||
"/redfish/v1/Systems/system/LogServices/{}/Entries/{}{}", | ||
logPath, entryID, linkAttachment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better to be
asyncResp->res.jsonValue[errorLogPropPath]["@odata.id"] =
boost::urls::format(
"/redfish/v1/Systems/{}/LogServices/{}/Entries/{}{}",
BMCWEB_REDFISH_SYSTEM_URI_NAME,
logPath, entryID, linkAttachment);
@@ -0,0 +1,690 @@ | |||
#pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License statement
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright OpenBMC Authors
#pragma once
#include <sdbusplus/message.hpp> | ||
#include <sdbusplus/message/native_types.hpp> | ||
#include <utils/error_log_utils.hpp> | ||
#include <utils/time_utils.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the above 2 include files would need to be (moved to the section L2-L7)
#include "utils/error_log_utils.hpp"
#include "utils/time_utils.hpp"
}, | ||
"xyz.openbmc_project.ObjectMapper", | ||
"/xyz/openbmc_project/object_mapper", | ||
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better to be done with
dbus::utility::getSubTreePaths(...)
// the respective hardware is not functional so | ||
// set the state as "Disabled". | ||
asyncResp->res.jsonValue["Status"]["State"] = | ||
"Disabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncResp->res.jsonValue["Status"]["State"] = resource::State::Disabled;
inline void getObjectEnable(std::shared_ptr<bmcweb::AsyncResp> asyncResp, | ||
const std::string& service, const std::string& path) | ||
{ | ||
sdbusplus::asio::getProperty<bool>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
} | ||
return; | ||
} | ||
sdbusplus::asio::getProperty<std::string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, | ||
const std::string& entryId, std::function<void(bool hidden)>&& callback) | ||
{ | ||
sdbusplus::asio::getProperty<bool>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
} | ||
|
||
// Get event properties and fill into status conditions | ||
sdbusplus::asio::getAllProperties( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getAllProperties
"LogServices/HardwareIsolation"}}); | ||
asyncResp->res.jsonValue["[email protected]"] = | ||
logServiceArrayLocal.size(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better like to in the older #1256
if constexpr (BMCWEB_HW_ISOLATION)
{
nlohmann::json& logServiceArrayLocal =
asyncResp->res.jsonValue["Members"];
nlohmann::json::object_t member;
member["@odata.id"] = boost::urls::format(
"redfish/v1/Systems/{}/LogServices/HardwareIsolation",
BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArrayLocal.emplace_back(std::move(member));
asyncResp->res.jsonValue["[email protected]"] =
logServiceArrayLocal.size();
}
crow::connections::systemBus->async_method_call( | ||
[asyncResp, resourceObjPath]( | ||
const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetAncestorsResponse& ancestors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this code is being carried forward from prior releases. But in its current format it goes against the OpenBMC coding standards. Specifically using long lambdas. Suggest cleaning this up to move into a named function instead.
(Same comment applies throughout this file and much of this review.)
// for parent chassis object id alone, so we should get one | ||
// element. | ||
BMCWEB_LOG_ERROR( | ||
"The given resource object [{}] is contains more than one Chassis as parent so failed return ChassisPowerStateOffRequiredError in the response", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraneous word: "is"
if (severityVal == | ||
"xyz.openbmc_project.Logging.Event.SeverityLevel.Critical") | ||
{ | ||
asyncResp->res.jsonValue[severityPropPath] = "Critical"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these strings map to generated Redfish enums?
// MessageRegistries | ||
std::vector<std::string> messageArgs{*msgPropVal}; | ||
|
||
// Fill the "msgPropVal" as reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this use the utility function fillMessageArgs() instead?
* @brief API used to process the Memory "Enabled" member which is | ||
* patched to do appropriate action. | ||
* | ||
* @param[in] resp - The redfish response to return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comment doesn't match name of parameter
crow::connections::systemBus->async_method_call( | ||
[asyncResp, dbusObjPath, | ||
entryJsonIdx](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really long lambda. It would be better to put it into a named function.
} | ||
|
||
// Fill the isolated hardware object id along with the Redfish URI | ||
std::string redfishUri = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use std::format() here.
severityString == | ||
"xyz.openbmc_project.HardwareIsolation.Entry.Type.Spare") | ||
{ | ||
entryJson["Severity"] = "OK"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this use a generated Redifsh enum?
crow::connections::systemBus->async_method_call( | ||
[asyncResp, entryId, | ||
entryObjPath](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file also has lots of long lambdas which would benefit the readability to move into named functions per the coding guidelines.
.methods(boost::beast::http::verb::get)( | ||
getSystemHardwareIsolationLogEntryCollection); | ||
|
||
BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better for searching the code if the Redfish URI path string was all in a single string. Same comment below.