OpenPOWER: Allow initiating mp reboot dump in quiesced state
When system dumps are disabled, a system dump collection
request will end up in quiesced state. A memory preserving
reboot from that state can get the failed data from the host.
So enabling the mp reboot dump collection from quiesced state.
Test:
Disable dump
Inject error in host to move to quiesced state
Start mp reboot
Dump should be generated
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I9f444752b321f1ab47b99e5b8ac32c79182d6453
diff --git a/dump-extensions/openpower-dumps/dump_manager_system.cpp b/dump-extensions/openpower-dumps/dump_manager_system.cpp
index 949c87c..e828371 100644
--- a/dump-extensions/openpower-dumps/dump_manager_system.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_system.cpp
@@ -154,11 +154,30 @@
sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
using Reason = xyz::openbmc_project::Common::NotAllowed::REASON;
- // Allow creating system dump only when the host is up.
- if (!phosphor::dump::isHostRunning())
+ auto isHostRunning = false;
+ phosphor::dump::HostState hostState;
+ try
{
+ isHostRunning = phosphor::dump::isHostRunning();
+ hostState = phosphor::dump::getHostState();
+ }
+ catch (const std::exception& e)
+ {
+ lg2::error(
+ "System state cannot be determined, system dump is not allowed: "
+ "{ERROR}",
+ "ERROR", e);
+ return std::string();
+ }
+ bool isHostQuiesced = hostState == phosphor::dump::HostState::Quiesced;
+ // Allow creating system dump only when the host is up or quiesced
+ if (!isHostRunning && !isHostQuiesced)
+ {
+ lg2::error("System dump can be initiated only when the host is up "
+ "or quiesced");
elog<NotAllowed>(
- Reason("System dump can be initiated only when the host is up"));
+ Reason("System dump can be initiated only when the host is up "
+ "or quiesced"));
return std::string();
}