summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-01-24 15:40:25 +0800
committerGunnar Mills <gmills@us.ibm.com>2019-01-29 22:30:37 +0000
commitc9caf86988b5695c117894df1628cba0cc4b4210 (patch)
tree02521c6b1af1760bd4de59dcc560f2479e33abdb
parentae81da466084a2db45e41e06f01123f2f35002dc (diff)
downloadopenpower-pnor-code-mgmt-c9caf86988b5695c117894df1628cba0cc4b4210.tar.gz
openpower-pnor-code-mgmt-c9caf86988b5695c117894df1628cba0cc4b4210.zip
Invoke Delete method to correct service
When PNOR code update is finished, it needs to invoke Delete interface to xyz.openbmc_project.Software.Version service to delete the temporary files in /tmp/images. The code was using the first service from mapper call, and the first service may be org.open_power.Software.Host.Updater, which is itself, and this method call results in ELOOP error. Change the code to pick the correct service to invoke Delete method. Resovles: openbmc/openbmc#3311 Tested: Verify the temp files in /tmp/images/<versionID> is deleted after PNOR code update, and no ELOOP error occurs. Change-Id: I855db171a05db66a5e4540d662031c3d219d4a9e Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r--activation.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/activation.cpp b/activation.cpp
index 7f3537f01..52427f0f6 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -220,12 +220,14 @@ auto Activation::requestedActivation(RequestedActivations value)
void Activation::deleteImageManagerObject()
{
// Get the Delete object for <versionID> inside image_manager
+ constexpr auto versionServiceStr = "xyz.openbmc_project.Software.Version";
+ constexpr auto deleteInterface = "xyz.openbmc_project.Object.Delete";
+ std::string versionService;
auto method = this->bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
MAPPER_INTERFACE, "GetObject");
method.append(path);
- method.append(
- std::vector<std::string>({"xyz.openbmc_project.Object.Delete"}));
+ method.append(std::vector<std::string>({deleteInterface}));
auto mapperResponseMsg = bus.call(method);
if (mapperResponseMsg.is_method_error())
{
@@ -242,10 +244,25 @@ void Activation::deleteImageManagerObject()
return;
}
+ // We need to find the phosphor-software-manager's version service
+ // to invoke the delete interface
+ for (auto resp : mapperResponse)
+ {
+ if (resp.first.find(versionServiceStr) != std::string::npos)
+ {
+ versionService = resp.first;
+ }
+ }
+
+ if (versionService.empty())
+ {
+ log<level::ERR>("Error finding version service");
+ return;
+ }
+
// Call the Delete object for <versionID> inside image_manager
- method = this->bus.new_method_call(
- (mapperResponse.begin()->first).c_str(), path.c_str(),
- "xyz.openbmc_project.Object.Delete", "Delete");
+ method = this->bus.new_method_call(versionService.c_str(), path.c_str(),
+ deleteInterface, "Delete");
try
{
auto mapperResponseMsg = bus.call(method);
OpenPOWER on IntegriCloud