Skip to content

Commit 29fa1f5

Browse files
authored
Merge pull request #542 from deepakala-k/sync_1030_commits
Sync HardwareIsolation 1030 commits to 1050
2 parents 9b0141f + 80107d5 commit 29fa1f5

16 files changed

+3398
-79
lines changed

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ feature_map = {
9696
'redfish-license' : '-DBMCWEB_ENABLE_REDFISH_LICENSE',
9797
#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY',
9898
'ibm-led-extensions' : '-DBMCWEB_ENABLE_IBM_LED_EXTENSIONS',
99+
'hw-isolation' : '-DBMCWEB_ENABLE_HW_ISOLATION',
99100
}
100101

101102
# Get the options status and build a project summary to show which flags are

meson_options.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,11 @@ option('ibm-led-extensions',
353353
type : 'feature',
354354
value : 'disabled',
355355
description : 'Enable the IBM LED extensions such as lamp test and system attention indicators'
356-
)
356+
)
357+
358+
option(
359+
'hw-isolation',
360+
type : 'feature',
361+
value : 'disabled',
362+
description : 'Enable the Hardware Isolation feature'
363+
)

redfish-core/include/error_messages.hpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,41 @@ nlohmann::json propertyValueIncorrect(std::string_view arg1,
482482
void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
483483
std::string_view arg2);
484484

485+
/**
486+
* @brief Formats PropertyValueResourceConflict message into JSON
487+
* Message body: "The property '%1' with the requested value of '%2' could
488+
* not be written because the value conflicts with the state or configuration
489+
* of the resource at '%3'."
490+
*
491+
* @param[in] arg1 Parameter of message that will replace %1 in its body.
492+
* @param[in] arg2 Parameter of message that will replace %2 in its body.
493+
* @param[in] arg3 Parameter of message that will replace %3 in its body.
494+
*
495+
* @returns Message PropertyValueResourceConflict to JSON */
496+
nlohmann::json propertyValueResourceConflict(const std::string& arg1,
497+
const std::string& arg2,
498+
const std::string& arg3);
499+
500+
void propertyValueResourceConflict(crow::Response& res, const std::string& arg1,
501+
const std::string& arg2,
502+
const std::string& arg3);
503+
504+
/**
505+
* @brief Formats PropertyValueExternalConflict message into JSON
506+
* Message body: "The property '%1' with the requested value of '%2' could not
507+
* be written because the value is not available due to a configuration
508+
* conflict."
509+
*
510+
* @param[in] arg1 Parameter of message that will replace %1 in its body.
511+
* @param[in] arg2 Parameter of message that will replace %2 in its body.
512+
*
513+
* @returns Message PropertyValueExternalConflict to JSON */
514+
nlohmann::json propertyValueExternalConflict(const std::string& arg1,
515+
const std::string& arg2);
516+
517+
void propertyValueExternalConflict(crow::Response& res, const std::string& arg1,
518+
const std::string& arg2);
519+
485520
/**
486521
* @brief Formats ResourceCreationConflict message into JSON
487522
* Message body: "The resource could not be created. The service has a resource

redfish-core/include/redfish.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ class RedfishService
185185
requestRoutesOperatingConfig(app);
186186
requestRoutesMemoryCollection(app);
187187
requestRoutesMemory(app);
188+
requestRoutesSubProcessors(app);
189+
requestRoutesSubProcessorsCore(app);
188190

189191
requestRoutesSystemsCollection(app);
190192
requestRoutesSystems(app);
@@ -260,6 +262,10 @@ class RedfishService
260262

261263
// Note, this must be the last route registered
262264
requestRoutesRedfish(app);
265+
266+
#ifdef BMCWEB_ENABLE_HW_ISOLATION
267+
requestRoutesSystemHardwareIsolationLogService(app);
268+
#endif
263269
}
264270
};
265271

redfish-core/include/registries/openbmc_message_registry.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,16 @@ constexpr std::array registry = {
567567
{"string"},
568568
"None.",
569569
}},
570+
MessageEntry{
571+
"HardwareIsolationReason",
572+
{
573+
"Indicates the condition that affects the health of this resource.",
574+
"The reason for the resource isolation: %1",
575+
"OK",
576+
1,
577+
{"string"},
578+
"None.",
579+
}},
570580
MessageEntry{"InvalidLoginAttempted",
571581
{
572582
"Indicates that a login was attempted on the specified "
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#pragma once
2+
3+
namespace redfish
4+
{
5+
namespace error_log_utils
6+
{
7+
8+
/*
9+
* @brief The helper API to set the Redfish error log URI in the given
10+
* Redfish property JSON path based on the Hidden property
11+
* which will be present in the given error log D-Bus object.
12+
*
13+
* @param[in] aResp - The redfish response to return.
14+
* @param[in] errorLogObjPath - The error log D-Bus object path.
15+
* @param[in] errorLogPropPath - The Redfish property json path to fill URI.
16+
* @param[in] isLink - The boolean to add URI as a Redfish link.
17+
*
18+
* @return NULL
19+
*
20+
* @note The "isLink" parameter is used to add the URI as a link (i.e with
21+
* "@odata.id"). If passed as "false" then, the suffix will be added
22+
* as "/attachment" along with the URI.
23+
*
24+
* This API won't fill the given "errorLogPropPath" property if unable
25+
* to process the given error log D-Bus object since the error log
26+
* might delete by the user via Redfish but, we should not throw
27+
* internal error in that case, just log trace and return.
28+
*/
29+
inline void
30+
setErrorLogUri(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
31+
const sdbusplus::message::object_path& errorLogObjPath,
32+
const nlohmann::json::json_pointer& errorLogPropPath,
33+
const bool isLink)
34+
{
35+
// Get the Hidden Property
36+
crow::connections::systemBus->async_method_call(
37+
[aResp, errorLogObjPath, errorLogPropPath,
38+
isLink](const boost::system::error_code ec,
39+
std::variant<bool>& hiddenProperty) {
40+
if (ec)
41+
{
42+
BMCWEB_LOG_ERROR
43+
<< "DBus response error [" << ec.value() << " : "
44+
<< ec.message() << "] when tried to get the Hidden property "
45+
<< "from the given error log object " << errorLogObjPath.str;
46+
return;
47+
}
48+
bool* hiddenPropVal = std::get_if<bool>(&hiddenProperty);
49+
if (hiddenPropVal == nullptr)
50+
{
51+
BMCWEB_LOG_ERROR << "Failed to get the Hidden property value "
52+
<< "from the given error log object "
53+
<< errorLogObjPath.str;
54+
return;
55+
}
56+
57+
std::string errLogUri{"/redfish/v1/Systems/system/LogServices/"};
58+
if (*hiddenPropVal)
59+
{
60+
errLogUri.append("CELog/Entries/");
61+
}
62+
else
63+
{
64+
errLogUri.append("EventLog/Entries/");
65+
}
66+
errLogUri.append(errorLogObjPath.filename());
67+
68+
if (isLink)
69+
{
70+
aResp->res.jsonValue[errorLogPropPath] = {{"@odata.id", errLogUri}};
71+
}
72+
else
73+
{
74+
errLogUri.append("/attachment");
75+
aResp->res.jsonValue[errorLogPropPath] = errLogUri;
76+
}
77+
},
78+
"xyz.openbmc_project.Logging", errorLogObjPath.str,
79+
"org.freedesktop.DBus.Properties", "Get",
80+
"org.open_power.Logging.PEL.Entry", "Hidden");
81+
}
82+
83+
} // namespace error_log_utils
84+
} // namespace redfish

0 commit comments

Comments
 (0)