PEL: Update Deconfig D-Bus property after clear
When a fan or power supply is replaced, the deconfig flag field in the
PEL is cleared. There is also a Deconfig property on D-Bus that should
match the PEL field, but the code to clear that was missed, so add it.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6fc971953b6e4d1e1c2da421bbc920923b199dbb
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index 1be0848..0a23e42 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -1094,7 +1094,26 @@
if ((attributes.creator == static_cast<uint8_t>(CreatorID::openBMC)) &&
attributes.deconfig)
{
- _repo.updatePEL(attributes.path, handlePowerThermalHardwarePresent);
+ auto updated = _repo.updatePEL(attributes.path,
+ handlePowerThermalHardwarePresent);
+
+ if (updated)
+ {
+ // Also update the property on D-Bus
+ auto objPath = std::string(OBJ_ENTRY) + '/' +
+ std::to_string(id.obmcID.id);
+ auto entryN = _pelEntries.find(objPath);
+ if (entryN != _pelEntries.end())
+ {
+ entryN->second->deconfig(false);
+ }
+ else
+ {
+ lg2::error(
+ "Could not find PEL Entry D-Bus object for {PATH}",
+ "PATH", objPath);
+ }
+ }
}
}
}
diff --git a/extensions/openpower-pels/repository.cpp b/extensions/openpower-pels/repository.cpp
index bc5249d..1860154 100644
--- a/extensions/openpower-pels/repository.cpp
+++ b/extensions/openpower-pels/repository.cpp
@@ -449,7 +449,7 @@
}
}
-void Repository::updatePEL(const fs::path& path, PELUpdateFunc updateFunc)
+bool Repository::updatePEL(const fs::path& path, PELUpdateFunc updateFunc)
{
std::ifstream file{path};
std::vector<uint8_t> data{std::istreambuf_iterator<char>(file),
@@ -481,6 +481,7 @@
}
write(pel, path);
+ return true;
}
}
else
@@ -488,6 +489,7 @@
throw std::runtime_error(
"Unable to read a valid PEL when trying to update it");
}
+ return false;
}
bool Repository::isServiceableSev(const PELAttributes& pel)
diff --git a/extensions/openpower-pels/repository.hpp b/extensions/openpower-pels/repository.hpp
index 7bb7a11..f64efb4 100644
--- a/extensions/openpower-pels/repository.hpp
+++ b/extensions/openpower-pels/repository.hpp
@@ -465,8 +465,10 @@
*
* @param[in] path - The file path to use
* @param[in] updateFunc - The function to run to update the PEL.
+ *
+ * @return bool - If the PEL was updated or not.
*/
- void updatePEL(const std::filesystem::path& path, PELUpdateFunc updateFunc);
+ bool updatePEL(const std::filesystem::path& path, PELUpdateFunc updateFunc);
private:
/**