Add option to enable/disable forced warm reboots
Some OpenBMC systems don't support a forced warm reboot. Provide a
compile option to enable/disable.
Tested:
- Confirmed that if feature is disabled, then AllowedHostTransitions did
not have ForceWarmReboot option.
Change-Id: I207b8fa7e3f60efbf406397ff4df980a5d2677ed
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index bf5e79a..160872d 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -88,8 +88,14 @@
void Host::setupSupportedTransitions()
{
std::set<Transition> supportedTransitions = {
- Transition::On, Transition::Off, Transition::Reboot,
- Transition::GracefulWarmReboot, Transition::ForceWarmReboot};
+ Transition::On,
+ Transition::Off,
+ Transition::Reboot,
+ Transition::GracefulWarmReboot,
+#if ENABLE_FORCE_WARM_REBOOT
+ Transition::ForceWarmReboot,
+#endif
+ };
server::Host::allowedHostTransitions(supportedTransitions);
}
diff --git a/meson.build b/meson.build
index cd01c3a..55f9b47 100644
--- a/meson.build
+++ b/meson.build
@@ -89,6 +89,10 @@
add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
endif
+if(get_option('force-warm-reboot').allowed())
+ add_project_arguments('-DENABLE_FORCE_WARM_REBOOT',language:'cpp')
+endif
+
nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
sdbusplus = dependency('sdbusplus')
sdeventplus = dependency('sdeventplus')
diff --git a/meson.options b/meson.options
index c2891bc..0c86bcb 100644
--- a/meson.options
+++ b/meson.options
@@ -101,6 +101,11 @@
description : 'Enable warm reboots of the system',
)
+option('force-warm-reboot', type : 'feature',
+ value : 'enabled',
+ description : 'Enable forced warm reboots of the system',
+)
+
option('host-gpios', type : 'feature',
value : 'disabled',
description : 'Enable gpio mechanism to check host state.',