Implement OriginatedBy interface in dump entry dbus obj
This new interface "OriginatedBy" will be implemented
by all the dump entry dbus objects. It contains a property
"OriginatorId" which stores the unique id of the user that
has initiated the dump. The unique id in this case is a string
that contains the ip address of the client that initiated
the dump.
The dbus interface change for the same is at:
[1] https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/47057
Tested By:
[1] busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/bmc xyz.openbmc_project.Dump.Create CreateDump a{sv} 2 "xyz.openbmc_project.Dump.Create.CreateParameters.OriginatorId" s "<unique-id>" "xyz.openbmc_project.Dump.Create.CreateParameters.OriginatorType" s "xyz.openbmc_project.Common.OriginatedBy.OriginatorTypes.Client" o "/xyz/openbmc_project/dump/bmc/entry/2"
[2] busctl --verbose call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/resource xyz.openbmc_project.Dump.Create CreateDump a{sv} 4 "com.ibm.Dump.Create.CreateParameters.VSPString" s "vsp" "com.ibm.Dump.Create.CreateParameters.Password" s "password" "com.ibm.Dump.Create.CreateParameters.OriginatorId" s "<unique-id>" "xyz.openbmc_project.Dump.Create.CreateParameters.OriginatorType" s "xyz.openbmc_project.Common.OriginatedBy.OriginatorTypes.Client"
MESSAGE "o" {
OBJECT_PATH "/xyz/openbmc_project/dump/resource/entry/1";
};
[3] busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/system xyz.openbmc_project.Dump.Create CreateDump a{sv} 2 "com.ibm.Dump.Create.CreateParameters.OriginatorId" s "<unique-id>" "xyz.openbmc_project.Dump.Create.CreateParameters.OriginatorType" s "xyz.openbmc_project.Common.OriginatedBy.OriginatorTypes.Client" o "/xyz/openbmc_project/dump/system/entry/1"
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Change-Id: I23c9f769fd39cd84e042d6effbb3d71c7af4e889
diff --git a/dump_manager_bmc.cpp b/dump_manager_bmc.cpp
index 66f780d..d5dd987 100644
--- a/dump_manager_bmc.cpp
+++ b/dump_manager_bmc.cpp
@@ -41,10 +41,19 @@
sdbusplus::message::object_path
Manager::createDump(phosphor::dump::DumpCreateParams params)
{
- if (!params.empty())
+ if (params.size() > CREATE_DUMP_MAX_PARAMS)
{
- log<level::WARNING>("BMC dump accepts no additional parameters");
+ log<level::WARNING>(
+ "BMC dump accepts not more than 2 additional parameters");
}
+
+ // Get the originator id and type from params
+ std::string originatorId;
+ originatorTypes originatorType;
+
+ phosphor::dump::extractOriginatorProperties(params, originatorId,
+ originatorType);
+
std::vector<std::string> paths;
auto id = captureDump(Type::UserRequested, paths);
@@ -61,7 +70,8 @@
entries.insert(std::make_pair(
id, std::make_unique<bmc::Entry>(
bus, objPath.c_str(), id, timeStamp, 0, std::string(),
- phosphor::dump::OperationStatus::InProgress, *this)));
+ phosphor::dump::OperationStatus::InProgress, originatorId,
+ originatorType, *this)));
}
catch (const std::invalid_argument& e)
{
@@ -168,13 +178,16 @@
// Entry Object path.
auto objPath = std::filesystem::path(baseEntryPath) / std::to_string(id);
+ // TODO: Get the persisted originator id & type
+ // For now, replacing it with null
try
{
entries.insert(std::make_pair(
id, std::make_unique<bmc::Entry>(
bus, objPath.c_str(), id, timestamp,
std::filesystem::file_size(file), file,
- phosphor::dump::OperationStatus::Completed, *this)));
+ phosphor::dump::OperationStatus::Completed, std::string(),
+ originatorTypes::Internal, *this)));
}
catch (const std::invalid_argument& e)
{