OpenPOWER: Limit User-Requested System Dumps
System dumps can be several gigabytes in size. To conserve space,
only one dump is stored at a time. When a new dump is requested,
the existing dump will be discarded while creating a new one.
In the case of system-generated dumps, which are triggered by
critical errors, it is permissible to initiate a new dump even
if an existing dump is already present in the host memory
This commit adds a restriction on initiating new user-requested system
dumps while a system dump is in progress or if one is already stored
in host memory.
New user-requested system dumps will be allowed once the existing
dump is deleted or offloaded.
This change applies only to user-requested dumps and does not impact
system generated dumps.
Test:
- Initiate system dump when another dump in progress and verified
a Unavailable was returned
- Force a system generated system dump when one dump is present
a Unavailable was returned
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I4598912b0761669859f84a43ab4c60f47664b1e6
diff --git a/dump-extensions/openpower-dumps/op_dump_util.hpp b/dump-extensions/openpower-dumps/op_dump_util.hpp
index 80c84a3..695fcd5 100644
--- a/dump-extensions/openpower-dumps/op_dump_util.hpp
+++ b/dump-extensions/openpower-dumps/op_dump_util.hpp
@@ -19,6 +19,28 @@
*/
bool isOPDumpsEnabled(sdbusplus::bus::bus& bus);
+using BIOSAttrValueType = std::variant<int64_t, std::string>;
+
+/** @brief Read a BIOS attribute value
+ *
+ * @param[in] attrName - Name of the BIOS attribute
+ * @param[in] bus - D-Bus handle
+ *
+ * @return The value of the BIOS attribute as a variant of possible types
+ *
+ * @throws sdbusplus::exception::SdBusError if failed to read the attribute
+ */
+BIOSAttrValueType readBIOSAttribute(const std::string& attrName,
+ sdbusplus::bus::bus& bus);
+
+/** @brief Check whether a system is in progress or available to offload.
+ *
+ * @param[in] bus - D-Bus handle
+ *
+ * @return true - A dump is in progress or available to offload
+ * false - No dump in progress
+ */
+bool isSystemDumpInProgress(sdbusplus::bus::bus& bus);
} // namespace util
} // namespace dump
} // namespace openpower