host-check: discover host state within state manager
Currently the phosphor-host-state-manager is started before the logic
has run to detect if the host is already running. This results in
phosphor-host-state-manager temporarily reporting that the host is not
running, even if it actually is. This can cause confusion for clients
monitoring this property.
The solution is to move the logic which discovers if the host is running
into phosphor-host-state-manager. Having the logic to do this in a
separate application was a nice separation of concerns but when the
requirement is a co-req, best to just combine them.
This change results in the phosphor-host-state-manager service starting
later in the boot to BMC Ready but testing has shown no impacts to
overall time to reach BMC Ready or impacts to other services.
As a part of this change, the phosphor-reset-sensor-states service was
moved out of the obmc-host-reset target to ensure it and the
phosphor-host-state-manager service have the correct dependency between
them. The phosphor-host-state-manager service now ensures it runs after
the pldm and ipmi services if they are being started (they are
utilized to check if the host is running).
Testing:
- Chassis On, Host On
Jul 30 14:40:37 rainxxx phosphor-host-state-manager[696]: Check if host is running
Jul 30 14:40:39 rainxxx phosphor-host-state-manager[696]: Host is running!
Jul 30 14:40:39 rainxxx phosphor-host-state-manager[696]: Initial Host State will be Running
- Chassis Off, Host Off
Jul 30 14:55:17 rainxxx phosphor-host-state-manager[710]: Check if host is running
Jul 30 14:55:17 rainxxx phosphor-host-state-manager[710]: Chassis power not on, exit
Jul 30 14:55:17 rainxxx phosphor-host-state-manager[710]: Initial Host State will be Off
- Chassis On, Host Off
Jul 30 14:57:11 rainxxx phosphor-host-state-manager[1193]: Check if host is running
Jul 30 14:57:18 rainxxx phosphor-host-state-manager[1193]: Host is not running!
Jul 30 14:57:18 rainxxx phosphor-host-state-manager[1193]: Initial Host State will be Off
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I938902f526fba2f857be4b21b01149f8250b972d
diff --git a/host_check.hpp b/host_check.hpp
new file mode 100644
index 0000000..0634f61
--- /dev/null
+++ b/host_check.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+/** @brief Determine if host is running
+ *
+ * @return True if host running, False otherwise
+ */
+bool isHostRunning();