summaryrefslogtreecommitdiff
path: root/redfish-core/lib/log_services.hpp
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2021-03-12 03:26:53 +0300
committerEd Tanous <ed@tanous.net>2021-03-28 23:48:12 +0300
commit8e6c099ac8d4b4b3163a26b58fa0f9abb987979a (patch)
tree27ca79aad2bc439173faa501bde22c038c50d5b8 /redfish-core/lib/log_services.hpp
parent3de8d8ba2880173fac03c949d9fae035442549ee (diff)
downloadbmcweb-8e6c099ac8d4b4b3163a26b58fa0f9abb987979a.tar.xz
Update Crashdump to the latest LogService and LogEntry schemas
This updates Crashdump to the latest LogService schema which now has a "CollectDiagnosticData" Action that replaces the OEM actions. It also updates to the latest LogEntry to use the new "AdditionalDataURI" property to provide the Crashdump file URI. Tested: Confirmed that the Crashdump LogEntries are displayed and can be collected correctly. Confirmed that the schema changes pass the Redfish Service Validator. Change-Id: I34f533b78441269a66201a13e990dba18745c7ba Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r--redfish-core/lib/log_services.hpp153
1 files changed, 58 insertions, 95 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 255c24ee84..47d61c0350 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2418,7 +2418,7 @@ class CrashdumpService : public Node
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/Crashdump";
asyncResp->res.jsonValue["@odata.type"] =
- "#LogService.v1_1_0.LogService";
+ "#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["Name"] = "Open BMC Oem Crashdump Service";
asyncResp->res.jsonValue["Description"] = "Oem Crashdump Service";
asyncResp->res.jsonValue["Id"] = "Oem Crashdump";
@@ -2431,19 +2431,15 @@ class CrashdumpService : public Node
{"#LogService.ClearLog",
{{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
"Actions/LogService.ClearLog"}}},
- {"Oem",
- {{"#Crashdump.OnDemand",
- {{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/Oem/Crashdump.OnDemand"}}},
- {"#Crashdump.Telemetry",
- {{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/Oem/Crashdump.Telemetry"}}}}}};
+ {"#LogService.CollectDiagnosticData",
+ {{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
+ "Actions/LogService.CollectDiagnosticData"}}}};
#ifdef BMCWEB_ENABLE_REDFISH_RAW_PECI
- asyncResp->res.jsonValue["Actions"]["Oem"].push_back(
+ asyncResp->res.jsonValue["Actions"]["Oem"] = {
{"#Crashdump.SendRawPeci",
{{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/Oem/Crashdump.SendRawPeci"}}});
+ "Actions/Oem/Crashdump.SendRawPeci"}}}};
#endif
}
};
@@ -2524,15 +2520,16 @@ static void logCrashdumpEntry(const std::shared_ptr<AsyncResp>& asyncResp,
std::string crashdumpURI =
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" +
logID + "/" + filename;
- logEntryJson = {{"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
+ logEntryJson = {{"@odata.type", "#LogEntry.v1_7_0.LogEntry"},
{"@odata.id", "/redfish/v1/Systems/system/"
"LogServices/Crashdump/Entries/" +
logID},
{"Name", "CPU Crashdump"},
{"Id", logID},
{"EntryType", "Oem"},
- {"OemRecordFormat", "Crashdump URI"},
- {"Message", std::move(crashdumpURI)},
+ {"AdditionalDataURI", std::move(crashdumpURI)},
+ {"DiagnosticDataType", "OEM"},
+ {"OEMDiagnosticDataType", "PECICrashdump"},
{"Created", std::move(timestamp)}};
};
crow::connections::systemBus->async_method_call(
@@ -2763,13 +2760,12 @@ class CrashdumpFile : public Node
}
};
-class OnDemandCrashdump : public Node
+class CrashdumpCollect : public Node
{
public:
- OnDemandCrashdump(App& app) :
- Node(app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
- "Crashdump.OnDemand/")
+ CrashdumpCollect(App& app) :
+ Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/"
+ "LogService.CollectDiagnosticData/")
{
// Note: Deviated from redfish privilege registry for GET & HEAD
// method for security reasons.
@@ -2788,82 +2784,28 @@ class OnDemandCrashdump : public Node
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
- auto generateonDemandLogCallback = [asyncResp,
- req](const boost::system::error_code
- ec,
- const std::string&) {
- if (ec)
- {
- if (ec.value() == boost::system::errc::operation_not_supported)
- {
- messages::resourceInStandby(asyncResp->res);
- }
- else if (ec.value() ==
- boost::system::errc::device_or_resource_busy)
- {
- messages::serviceTemporarilyUnavailable(asyncResp->res,
- "60");
- }
- else
- {
- messages::internalError(asyncResp->res);
- }
- return;
- }
- std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
- [](boost::system::error_code err, sdbusplus::message::message&,
- const std::shared_ptr<task::TaskData>& taskData) {
- if (!err)
- {
- taskData->messages.emplace_back(
- messages::taskCompletedOK(
- std::to_string(taskData->index)));
- taskData->state = "Completed";
- }
- return task::completed;
- },
- "type='signal',interface='org.freedesktop.DBus.Properties',"
- "member='PropertiesChanged',arg0namespace='com.intel."
- "crashdump'");
- task->startTimer(std::chrono::minutes(5));
- task->populateResp(asyncResp->res);
- task->payload.emplace(req);
- };
- crow::connections::systemBus->async_method_call(
- std::move(generateonDemandLogCallback), crashdumpObject,
- crashdumpPath, crashdumpOnDemandInterface, "GenerateOnDemandLog");
- }
-};
-
-class TelemetryCrashdump : public Node
-{
- public:
- TelemetryCrashdump(App& app) :
- Node(app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
- "Crashdump.Telemetry/")
- {
- // Note: Deviated from redfish privilege registry for GET & HEAD
- // method for security reasons.
- entityPrivileges = {
- {boost::beast::http::verb::get, {{"ConfigureComponents"}}},
- {boost::beast::http::verb::head, {{"ConfigureComponents"}}},
- {boost::beast::http::verb::patch, {{"ConfigureComponents"}}},
- {boost::beast::http::verb::put, {{"ConfigureComponents"}}},
- {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
- {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
- }
+ std::string diagnosticDataType;
+ std::string oemDiagnosticDataType;
+ if (!redfish::json_util::readJson(
+ req, asyncResp->res, "DiagnosticDataType", diagnosticDataType,
+ "OEMDiagnosticDataType", oemDiagnosticDataType))
+ {
+ return;
+ }
- private:
- void doPost(crow::Response& res, const crow::Request& req,
- const std::vector<std::string>&) override
- {
- std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
+ if (diagnosticDataType != "OEM")
+ {
+ BMCWEB_LOG_ERROR
+ << "Only OEM DiagnosticDataType supported for Crashdump";
+ messages::actionParameterValueFormatError(
+ asyncResp->res, diagnosticDataType, "DiagnosticDataType",
+ "CollectDiagnosticData");
+ return;
+ }
- auto generateTelemetryLogCallback = [asyncResp, req](
- const boost::system::error_code
- ec,
- const std::string&) {
+ auto collectCrashdumpCallback = [asyncResp, req](
+ const boost::system::error_code ec,
+ const std::string&) {
if (ec)
{
if (ec.value() == boost::system::errc::operation_not_supported)
@@ -2901,9 +2843,30 @@ class TelemetryCrashdump : public Node
task->populateResp(asyncResp->res);
task->payload.emplace(req);
};
- crow::connections::systemBus->async_method_call(
- std::move(generateTelemetryLogCallback), crashdumpObject,
- crashdumpPath, crashdumpTelemetryInterface, "GenerateTelemetryLog");
+
+ if (oemDiagnosticDataType == "OnDemand")
+ {
+ crow::connections::systemBus->async_method_call(
+ std::move(collectCrashdumpCallback), crashdumpObject,
+ crashdumpPath, crashdumpOnDemandInterface,
+ "GenerateOnDemandLog");
+ }
+ else if (oemDiagnosticDataType == "Telemetry")
+ {
+ crow::connections::systemBus->async_method_call(
+ std::move(collectCrashdumpCallback), crashdumpObject,
+ crashdumpPath, crashdumpTelemetryInterface,
+ "GenerateTelemetryLog");
+ }
+ else
+ {
+ BMCWEB_LOG_ERROR << "Unsupported OEMDiagnosticDataType: "
+ << oemDiagnosticDataType;
+ messages::actionParameterValueFormatError(
+ asyncResp->res, oemDiagnosticDataType, "OEMDiagnosticDataType",
+ "CollectDiagnosticData");
+ return;
+ }
}
};