diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2017-07-27 16:44:43 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-08-12 14:10:34 +0000 |
commit | a27a6e81e52691625121edefca850a48a2e4682b (patch) | |
tree | 294b98f875482bfe92fe0dfb28281125d54762b3 | |
parent | 2710e730c698952b6803fea2af6c63bff8ff385c (diff) | |
download | phosphor-state-manager-a27a6e81e52691625121edefca850a48a2e4682b.tar.gz phosphor-state-manager-a27a6e81e52691625121edefca850a48a2e4682b.zip |
Use new host reboot target to reboot host
Resolves openbmc/openbmc#2032
Change-Id: Iaee1fcae2a758324266cd8afdc2a738f7838aca4
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
-rw-r--r-- | host_state_manager.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/host_state_manager.cpp b/host_state_manager.cpp index 83f21e7..515c31b 100644 --- a/host_state_manager.cpp +++ b/host_state_manager.cpp @@ -32,6 +32,7 @@ namespace fs = std::experimental::filesystem; constexpr auto HOST_STATE_SOFT_POWEROFF_TGT = "obmc-host-shutdown@0.target"; constexpr auto HOST_STATE_POWEROFF_TGT = "obmc-host-stop@0.target"; constexpr auto HOST_STATE_POWERON_TGT = "obmc-host-start@0.target"; +constexpr auto HOST_STATE_REBOOT_TGT = "obmc-host-reboot@0.target"; constexpr auto HOST_STATE_QUIESCE_TGT = "obmc-host-quiesce@0.target"; constexpr auto ACTIVE_STATE = "active"; @@ -41,7 +42,8 @@ constexpr auto ACTIVATING_STATE = "activating"; const std::map<server::Host::Transition,std::string> SYSTEMD_TARGET_TABLE = { {server::Host::Transition::Off, HOST_STATE_SOFT_POWEROFF_TGT}, - {server::Host::Transition::On, HOST_STATE_POWERON_TGT} + {server::Host::Transition::On, HOST_STATE_POWERON_TGT}, + {server::Host::Transition::Reboot, HOST_STATE_REBOOT_TGT} }; constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; @@ -278,13 +280,6 @@ void Host::sysStateChange(sdbusplus::message::message& msg) log<level::INFO>("Received signal that host is off"); this->currentHostState(server::Host::HostState::Off); - // Check if we need to start a new transition (i.e. a Reboot) - if(this->server::Host::requestedHostTransition() == - Transition::Reboot) - { - log<level::DEBUG>("Reached intermediate state, going to next"); - this->executeTransition(server::Host::Transition::On); - } } else if((newStateUnit == HOST_STATE_POWERON_TGT) && (newStateResult == "done") && @@ -318,24 +313,7 @@ Host::Transition Host::requestedHostTransition(Transition value) entry("REQUESTED_HOST_TRANSITION=%s", convertForMessage(value).c_str())); - Transition tranReq = value; - if(value == server::Host::Transition::Reboot) - { - // On reboot requests we just need to do a off if we're on and - // vice versa. The handleSysStateChange() code above handles the - // second part of the reboot - if(this->server::Host::currentHostState() == - server::Host::HostState::Off) - { - tranReq = server::Host::Transition::On; - } - else - { - tranReq = server::Host::Transition::Off; - } - } - - executeTransition(tranReq); + executeTransition(value); auto retVal = server::Host::requestedHostTransition(value); serialize(*this); return retVal; |