set requested state to off when power policy is always-off
Issue:
Step 1: Set the power policy to "always-on" then turn off/on the chassis
power. HOST shall be turned on after BMC has been rebooted.
Step 2: Set the power policy to "always-off" then turn off/on the
chassis power. HOST shall be turn off after BMC has been rebooted.
Step 3: Set the power policy to "previous" then turn off/on the chassis
power. Wait until BMC has been rebooted.
Expect: At step 3, HOST should be turned off due to BMC turned off HOST
in step 2.
Actual: At step 3, HOST is turned on.
Root cause: In step 1, BMC updated the requested state to "On". But in
step 2, BMC did not update requested state to "Off", it is still "On".
Therefore, in step 3, when BMC check the requested state (it is being
"On"), BMC turns on the HOST.
Solution: When power policy is "always-off", set the requested state to
"Off".
Tested:
Repeat 3 above steps, at step 3, HOST state is "Off"
Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
Change-Id: Ib50de99ae935f2ccb777226d78848e33e5db9906
diff --git a/discover_system_state.cpp b/discover_system_state.cpp
index 7f6855e..f638561 100644
--- a/discover_system_state.cpp
+++ b/discover_system_state.cpp
@@ -212,6 +212,13 @@
setProperty(bus, hostPath, HOST_BUSNAME, "RequestedHostTransition",
convertForMessage(server::Host::Transition::On));
}
+ else if (RestorePolicy::Policy::AlwaysOff ==
+ RestorePolicy::convertPolicyFromString(powerPolicy))
+ {
+ info("power_policy=ALWAYS_POWER_OFF, set requested state to off");
+ setProperty(bus, hostPath, HOST_BUSNAME, "RequestedHostTransition",
+ convertForMessage(server::Host::Transition::Off));
+ }
else if (RestorePolicy::Policy::Restore ==
RestorePolicy::convertPolicyFromString(powerPolicy))
{