Use new host reboot target to reboot host

Resolves openbmc/openbmc#2032

Change-Id: Iaee1fcae2a758324266cd8afdc2a738f7838aca4
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
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 @@
 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 @@
 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 @@
         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 @@
             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;