Use new host-startmin target for host state
https://gerrit.openbmc-project.xyz/#/c/9774/ introduced a new
minimum host-start target. This allows additional services to
be added to the host-start process that should only be run during
fresh boots of the system.
The phosphor-host-state application needs to now look for this
obmc-host-startmin@.target to determine when the host is started
or stopped. The obmc-host-start@.target should still be started
to boot (under the covers it just calls host-startmin).
The reason for this change is that only the minimum target will be
called in auto reboot situations (host boot errors, host reboot
requests) and this application needs to monitor for all of these.
Tested: Built this with the referenced commit above and
verified on/off/reboot all were processed and displayed
properly by phosphor-host-state-manager
Change-Id: I66877ecc975761e18f75797da10480ee42767ca9
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index 1ddd150..ec1f95f 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -41,6 +41,7 @@
constexpr auto HOST_STATE_SOFT_POWEROFF_TGT = "obmc-host-shutdown@0.target";
constexpr auto HOST_STATE_POWEROFF_TGT = "obmc-host-stop@0.target";
constexpr auto HOST_STATE_POWERON_TGT = "obmc-host-start@0.target";
+constexpr auto HOST_STATE_POWERON_MIN_TGT = "obmc-host-startmin@0.target";
constexpr auto HOST_STATE_REBOOT_TGT = "obmc-host-reboot@0.target";
constexpr auto HOST_STATE_QUIESCE_TGT = "obmc-host-quiesce@0.target";
@@ -82,7 +83,7 @@
void Host::determineInitialState()
{
- if (stateActive(HOST_STATE_POWERON_TGT))
+ if (stateActive(HOST_STATE_POWERON_MIN_TGT))
{
log<level::INFO>("Initial Host State will be Running",
entry("CURRENT_HOST_STATE=%s",
@@ -232,16 +233,17 @@
msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
if ((newStateUnit == HOST_STATE_POWEROFF_TGT) &&
- (newStateResult == "done") && (!stateActive(HOST_STATE_POWERON_TGT)))
+ (newStateResult == "done") &&
+ (!stateActive(HOST_STATE_POWERON_MIN_TGT)))
{
log<level::INFO>("Received signal that host is off");
this->currentHostState(server::Host::HostState::Off);
this->bootProgress(bootprogress::Progress::ProgressStages::Unspecified);
this->operatingSystemState(osstatus::Status::OSStatus::Inactive);
}
- else if ((newStateUnit == HOST_STATE_POWERON_TGT) &&
+ else if ((newStateUnit == HOST_STATE_POWERON_MIN_TGT) &&
(newStateResult == "done") &&
- (stateActive(HOST_STATE_POWERON_TGT)))
+ (stateActive(HOST_STATE_POWERON_MIN_TGT)))
{
log<level::INFO>("Received signal that host is running");
this->currentHostState(server::Host::HostState::Running);