diag-mode: support entry into diagnostic mode
See DiagnosticMode definition in phosphor-dbus-interfaces for more
information:
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/State/Host.interface.yaml
This target will be started by other software entities within OpenBMC so
phosphor-host-state-manager will monitor for this target to start and
update its state accordingly. System defined behavior will then
transition the system out of this state (quiesce, off, warm-reboot) and
state-manager will update as needed when those are seen.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ide599058dfe5596c3f40c9c295dd1259853b15a7
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index d9b0319..bdc2a86 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -49,6 +49,8 @@
constexpr auto HOST_STATE_WARM_REBOOT = "obmc-host-warm-reboot@0.target";
constexpr auto HOST_STATE_FORCE_WARM_REBOOT =
"obmc-host-force-warm-reboot@0.target";
+constexpr auto HOST_STATE_DIAGNOSTIC_MODE =
+ "obmc-host-diagnostic-mode@0.target";
constexpr auto HOST_STATE_QUIESCE_TGT = "obmc-host-quiesce@0.target";
@@ -274,6 +276,22 @@
}
}
+void Host::sysStateChangeJobNew(sdbusplus::message::message& msg)
+{
+ uint32_t newStateID{};
+ sdbusplus::message::object_path newStateObjPath;
+ std::string newStateUnit{};
+
+ // Read the msg and populate each variable
+ msg.read(newStateID, newStateObjPath, newStateUnit);
+
+ if (newStateUnit == HOST_STATE_DIAGNOSTIC_MODE)
+ {
+ log<level::INFO>("Received signal that host is in diagnostice mode");
+ this->currentHostState(server::Host::HostState::DiagnosticMode);
+ }
+}
+
uint32_t Host::decrementRebootCount()
{
auto rebootCount = reboot::RebootAttempts::attemptsLeft();