meta-bletchley: add bletchley-host-state-monitor service
Add a service for monitoring host power state by query port status via
mdio bus.
Test Results:
- Poweron SLED6
root@bletchley:~# obmcutil -i=6 poweron
root@bletchley:~# obmcutil -i=6 state
CurrentBMCState : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState : xyz.openbmc_project.State.Chassis.PowerState.On
CurrentHostState : xyz.openbmc_project.State.Host.HostState.Running
BootProgress : xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified
OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive
root@bletchley:~# journalctl -u bletchley-host-state-monitor
...
Oct 24 07:55:17 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:18 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:22 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:23 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:27 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:29 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:30 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 3
Oct 24 07:55:31 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 2
Oct 24 07:55:33 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 1
Oct 24 07:55:34 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed, update host state to ON
- Poweroff SLED6
root@bletchley:~# obmcutil -i=6 poweroff
root@bletchley:~# obmcutil -i=6 state
CurrentBMCState : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState : xyz.openbmc_project.State.Chassis.PowerState.Off
CurrentHostState : xyz.openbmc_project.State.Host.HostState.Off
BootProgress : xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified
OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive
root@bletchley:~# journalctl -u bletchley-host-state-monitor
Oct 21 09:38:21 bletchley systemd[1]: Started Bletchley host state monitoring.
...
Oct 24 07:55:17 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:18 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:22 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:23 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:27 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 5
Oct 24 07:55:29 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 4
Oct 24 07:55:30 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 3
Oct 24 07:55:31 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 2
Oct 24 07:55:33 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:OFF, current:ON), check count: 1
Oct 24 07:55:34 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed, update host state to ON
Oct 24 08:03:38 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:ON, current:OFF), check count: 5
Oct 24 08:03:39 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:ON, current:OFF), check count: 4
Oct 24 08:03:40 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:ON, current:OFF), check count: 3
Oct 24 08:03:42 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:ON, current:OFF), check count: 2
Oct 24 08:03:43 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed (previous:ON, current:OFF), check count: 1
Oct 24 08:03:44 bletchley bletchley-host-state-monitor[905]: SLED6: detected state changed, update host state to OFF
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I5916cd411c0d7d625b54f74c888aa380e00a1853
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/plat-svc/plat-svc_0.1.bb b/meta-facebook/meta-bletchley/recipes-bletchley/plat-svc/plat-svc_0.1.bb
index 23b2d1f..ecf232f 100644
--- a/meta-facebook/meta-bletchley/recipes-bletchley/plat-svc/plat-svc_0.1.bb
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/plat-svc/plat-svc_0.1.bb
@@ -6,23 +6,25 @@
RDEPENDS:${PN} += "bash"
RDEPENDS:${PN} += "libgpiod-tools"
RDEPENDS:${PN} += "bletchley-common-functions"
+RDEPENDS:${PN} += "mdio-tools"
SRC_URI += " \
file://bletchley-early-sys-init \
file://bletchley-sys-init.service \
+ file://bletchley-host-state-monitor \
+ file://bletchley-host-state-monitor.service \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN}:append = " \
bletchley-sys-init.service \
+ bletchley-host-state-monitor.service \
"
do_install() {
install -d ${D}${libexecdir}
install -m 0755 ${WORKDIR}/bletchley-early-sys-init ${D}${libexecdir}
-
- install -d ${D}${systemd_system_unitdir}
- install -m 0644 ${WORKDIR}/bletchley-sys-init.service ${D}${systemd_system_unitdir}
+ install -m 0755 ${WORKDIR}/bletchley-host-state-monitor ${D}${libexecdir}
}
SYSTEMD_OVERRIDE:${PN}:bletchley += "bletchley-sys-init.conf:bletchley-sys-init.service.d/bletchley-sys-init.conf"