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-extensions/openpower-dumps/dump_manager_resource.cpp b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
index a151961..604e796 100644
--- a/dump-extensions/openpower-dumps/dump_manager_resource.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
@@ -80,6 +80,9 @@
auto idString = std::to_string(id);
auto objPath = std::filesystem::path(baseEntryPath) / idString;
+ // TODO: Get the originator Id, type from the persisted file.
+ // For now replacing it with null
+
try
{
log<level::INFO>(fmt::format("Resouce Dump Notify: creating new dump "
@@ -90,7 +93,8 @@
id, std::make_unique<resource::Entry>(
bus, objPath.c_str(), id, timeStamp, size, dumpId,
std::string(), std::string(),
- phosphor::dump::OperationStatus::Completed, *this)));
+ phosphor::dump::OperationStatus::Completed, std::string(),
+ originatorTypes::Internal, *this)));
}
catch (const std::invalid_argument& e)
{
@@ -192,13 +196,20 @@
}
}
+ // Get the originator id and type from params
+ std::string originatorId;
+ originatorTypes originatorType;
+
+ phosphor::dump::extractOriginatorProperties(params, originatorId,
+ originatorType);
+
try
{
entries.insert(std::make_pair(
id, std::make_unique<resource::Entry>(
bus, objPath.c_str(), id, timeStamp, 0, INVALID_SOURCE_ID,
vspString, pwd, phosphor::dump::OperationStatus::InProgress,
- *this)));
+ originatorId, originatorType, *this)));
}
catch (const std::invalid_argument& e)
{