PEL: Prevent deletion if it's associated with HWIsolation
- This ensures that PELs linked to HWIsolation records are protected
from accidental deletion.
- Shows error message of "Call failed: The service is temporarily
unavailable.", when attempting to delete such a PEL individually.
- If trying to Delete all, will skip such PELs without showing any
message.
Tested:
Sample output:
```bash
$ busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/
logging xyz.openbmc_project.Collection.DeleteAll DeleteAll
$ busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/
logging/entry/2 xyz.openbmc_project.Object.Delete Delete
Call failed: The service is temporarily unavailable.
```
Change-Id: I2d28de91bbb0fbc2a991e3d5e5631814d41fe044
Signed-off-by: Harsh Agarwal <Harsh.Agarwal@ibm.com>
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index 713f4cd..c6cfe4e 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -537,6 +537,23 @@
*/
void addDIMMLocCode(const std::string& locCode, bool isFRUDIMM);
+ /**
+ * @brief Finds all D-Bus Associated paths that contain any of the
+ * interfaces passed in, by using GetAssociatedSubTreePaths.
+ *
+ * @param[in] associatedPath - The D-Bus object path
+ * @param[in] subtree - The subtree path for which the result should be
+ * fetched
+ * @param[in] depth - The maximum subtree depth for which results should be
+ * fetched
+ * @param[in] interfaces - The desired interfaces
+ *
+ * @return The D-Bus paths.
+ */
+ virtual DBusPathList getAssociatedPaths(
+ const DBusPath& associatedPath, const DBusPath& subtree, int32_t depth,
+ const DBusInterfaceList& interfaces) const = 0;
+
protected:
/**
* @brief Sets the host on/off state and runs any
@@ -907,6 +924,23 @@
std::optional<std::vector<uint8_t>>
getDIProperty(const std::string& locationCode) const override;
+ /**
+ * @brief Finds all D-Bus Associated paths that contain any of the
+ * interfaces passed in, by using GetAssociatedSubTreePaths.
+ *
+ * @param[in] associatedPath - The D-Bus object path
+ * @param[in] subtree - The subtree path for which the result should be
+ * fetched
+ * @param[in] depth - The maximum subtree depth for which results should be
+ * fetched
+ * @param[in] interfaces - The desired interfaces
+ *
+ * @return The D-Bus paths.
+ */
+ DBusPathList getAssociatedPaths(
+ const DBusPath& associatedPath, const DBusPath& subtree, int32_t depth,
+ const DBusInterfaceList& interfaces) const override;
+
private:
/**
* @brief Reads the BMC firmware version string and puts it into