supportedTransitions: Add in support for new prop
This new property was added [1] to allow users to define the specific
host transition operations they want to allow.
This commit starts with the default, allowing all operations. Future
commits will provide mechanisms to configure this.
Tested:
```
busctl get-property xyz.openbmc_project.State.Host
/xyz/openbmc_project/state/host0
xyz.openbmc_project.State.Host
AllowedHostTransitions
as 5 "xyz.openbmc_project.State.Host.Transition.On"
"xyz.openbmc_project.State.Host.Transition.Off"
"xyz.openbmc_project.State.Host.Transition.Reboot"
"xyz.openbmc_project.State.Host.Transition.GracefulWarmReboot"
"xyz.openbmc_project.State.Host.Transition.ForceWarmReboot"
```
[1]: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/68933
Change-Id: Ifdac18ab67e3e68d49b9bca9446ba84ee954f96c
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index cf8105f..bf5e79a 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -26,6 +26,7 @@
#include <fstream>
#include <iostream>
#include <map>
+#include <set>
#include <string>
// Register class version with Cereal
@@ -84,6 +85,14 @@
return;
}
+void Host::setupSupportedTransitions()
+{
+ std::set<Transition> supportedTransitions = {
+ Transition::On, Transition::Off, Transition::Reboot,
+ Transition::GracefulWarmReboot, Transition::ForceWarmReboot};
+ server::Host::allowedHostTransitions(supportedTransitions);
+}
+
void Host::createSystemdTargetMaps()
{
stateTargetTable = {