call new obmc-chassis-blackout@.target on blackout
The following commit introduced a new systemd target to be called when
OpenBMC firmware detects a power blackout has occurred (system
unexpectedly lost all power to system):
https://gerrit.openbmc.org/c/openbmc/docs/+/54204
This target is now in place and the appropriate services have been
installed into it. Switch the state-manager code over to call this new
target.
Tested:
- Verified in simulation that the target was called when the system
experienced a blackout.
From a powered off state.
root@p10bmc: systemctl stop xyz.openbmc_project.State.Chassis.service
Manipulated file to indicate that the power was on before service ended
root@p10bmc: vi /var/lib/chassStateChangeTime
root@p10bmc: systemctl start xyz.openbmc_project.State.Chassis.service
Jun 22 17:05:37 p10bmc phosphor-chassis-state-manager[1155]:
The system suffered a power blackout.
root@p10bmc: systemctl status obmc-chassis-blackout@0.target
Active: active since Wed 2022-06-22 17:05:37 UTC; 8s ago
root@p10bmc: systemctl status phosphor-reset-state-sensors@0.service
Jun 22 17:05:37 p10bmc systemd[1]: Finished Reset host sensors.
root@p10bmc: systemctl status obmc-led-group-stop@power_on.service
Active: active (exited) since Wed 2022-06-22 17:05:37 UTC; 8s ago
Signed-off-by: Corey Hardesty <corey.hardesty@icloud.com>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: If95f8da52ec024e699204f4b26784c7457da5abf
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index 9bfdb95..ba30c73 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -44,8 +44,7 @@
constexpr auto CHASSIS_STATE_HARD_POWEROFF_TGT_FMT =
"obmc-chassis-hard-poweroff@{}.target";
constexpr auto CHASSIS_STATE_POWERON_TGT_FMT = "obmc-chassis-poweron@{}.target";
-constexpr auto RESET_HOST_SENSORS_SVC_FMT =
- "phosphor-reset-sensor-states@{}.service";
+constexpr auto CHASSIS_BLACKOUT_TGT_FMT = "obmc-chassis-blackout@{}.target";
constexpr auto AUTO_POWER_RESTORE_SVC_FMT =
"phosphor-discover-system-state@{}.service";
constexpr auto ACTIVE_STATE = "active";
@@ -155,9 +154,8 @@
"Chassis power was on before the BMC reboot and it is off now");
// Reset host sensors since system is off now
- // TODO: when CHASSIS_BLACKOUT_TGT will include this service
- // Needs to be removed when the blackout target is merged
- startUnit(fmt::format(RESET_HOST_SENSORS_SVC_FMT, id));
+ // Ensure Power Leds are off.
+ startUnit(fmt::format(CHASSIS_BLACKOUT_TGT_FMT, id));
setStateChangeTime();
// Generate file indicating AC loss occurred