Host reboot configuration support
Redfish API now supports a mechanism for the users of the system
to configure the number of times a BMC should restart the host
firmware when in an error path before giving up. Originally
the function "attemptsLeft(uint32_t)" ignored the passed in value
and and always set this number to a hardcoded 3(without the user
knowing). Changes made here allow for this property to be set by
an external user over D-bus for values other than 3.
To compliment this functionality and the new DBus property
"RetryAttempts" an override was created to ensure that when
"RetryAttempts" is set by an external user that the "AttemptsLeft"
property is updated accordingly.
Versioning was added to avoid a serialization error that
would occur if a system was loaded using the previous version that did
not include this new property.
Testing:
- Using the newly defined cereal version of '2' performed correctly.
- Removing the new property and reverting cereal class version back
to '1' behaved properly.
- built and ran with Docker along with the web changes.
- verified update of "AttemptsLeft" through a p10bmc running
on simics through busctl.
- verified that when the "RetryAttempts" policy value is changed by
either bmcweb or dbus set-property() that "AttemptsLeft" updates
accordingly.
busctl set-property xyz.openbmc_project.State.Host ... RetryAttempts u 1
busctl get-property xyz.openbmc_project.State.Host ... RetryAttempts
service@p10bmc: u 1
busctl get-property xyz.openbmc_project.State.Host ... AttemptsLeft
service@p10bmc: u 1
busctl set-property xyz.openbmc_project.State.Host ... RetryAttempts u 3
busctl set-property xyz.openbmc_project.State.Host ... AttemptLeft u 8
busctl get-property xyz.openbmc_project.State.Host ... AttemptLeft u 3
service@p10bmc: u 3
Signed-off-by: Corey Hardesty <corey.hardesty@icloud.com>
Change-Id: I70a8457c88fb76e118937d79e8dbe15518df7264
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index e3b04ac..bec0f0a 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -253,7 +253,7 @@
{
// We are at 0 so reset reboot counter and go to quiesce state
info("Auto reboot enabled but HOST BOOTCOUNT already set to 0");
- attemptsLeft(BOOT_COUNT_MAX_ALLOWED);
+ attemptsLeft(reboot::RebootAttempts::retryAttempts());
// Generate log since we will now be sitting in Quiesce
const std::string errorMsg =