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_faultlog.cpp b/dump_manager_faultlog.cpp
index a718472..7bb8352 100644
--- a/dump_manager_faultlog.cpp
+++ b/dump_manager_faultlog.cpp
@@ -2,6 +2,7 @@
#include "dump_manager_faultlog.hpp"
+#include "dump_utils.hpp"
#include "faultlog_dump_entry.hpp"
#include <fmt/core.h>
@@ -46,6 +47,13 @@
log<level::INFO>("Got additional parameters");
}
+ // Get the originator id and type from params
+ std::string originatorId;
+ originatorTypes originatorType;
+
+ phosphor::dump::extractOriginatorProperties(params, originatorId,
+ originatorType);
+
// Get the id
auto id = lastEntryId + 1;
auto idString = std::to_string(id);
@@ -89,12 +97,13 @@
std::chrono::system_clock::now().time_since_epoch())
.count();
- entries.insert(std::make_pair(
- id,
- std::make_unique<faultlog::Entry>(
- bus, objPath.c_str(), id, timestamp,
- std::filesystem::file_size(faultLogFilePath), faultLogFilePath,
- phosphor::dump::OperationStatus::Completed, *this)));
+ entries.insert(
+ std::make_pair(id, std::make_unique<faultlog::Entry>(
+ bus, objPath.c_str(), id, timestamp,
+ std::filesystem::file_size(faultLogFilePath),
+ faultLogFilePath,
+ phosphor::dump::OperationStatus::Completed,
+ originatorId, originatorType, *this)));
}
catch (const std::invalid_argument& e)
{