bmc-reboot: put into NotReady state

When a reboot of the BMC has been requested, there is a period of time
where certain services, like the BMC webserver, are still running. This
can be confusing to external clients that do not know the BMC reboot is
occurring and who are still expecting the BMC interfaces (like Redfish)
to continue working. Provide at least a cookie crumb to external clients
by switching the BMC state to NotReady when a BMC reboot is initiated.

This allows client a method to read the BMC state via the redfish
managers API and know the state of the BMC.

Tested:
- Verified when I initiated a reboot of the BMC via the
  RequestedBMCTransition property that the BMC state was set to
  NotReady

Apr 28 20:12:53 witherspoon phosphor-bmc-state-manager[337]: Setting the RequestedBMCTransition field to xyz.openbmc_project.State.BMC.Transition.Reboot
Apr 28 20:12:53 witherspoon phosphor-bmc-state-manager[337]: Setting the BMCState field to xyz.openbmc_project.State.BMC.BMCState.NotReady
... <BMC rebooted>
Apr 28 20:15:27 witherspoon phosphor-bmc-state-manager[349]: Setting the BMCState field to BMC_NOTREADY
Apr 28 20:15:27 witherspoon phosphor-bmc-state-manager[349]: Setting the BMCState field to xyz.openbmc_project.State.BMC.BMCState.NotReady
Apr 28 20:15:27 witherspoon phosphor-bmc-state-manager[349]: Setting the RebootCause field to xyz.openbmc_project.State.BMC.RebootCause.Unknown
Apr 28 20:15:57 witherspoon phosphor-bmc-state-manager[349]: BMC_READY
Apr 28 20:15:57 witherspoon phosphor-bmc-state-manager[349]: Setting the BMCState field to xyz.openbmc_project.State.BMC.BMCState.Ready

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I97b1191769390e7774fb1d3714e8b3f742838f6a
diff --git a/bmc_state_manager.cpp b/bmc_state_manager.cpp
index a921fda..49aaf36 100644
--- a/bmc_state_manager.cpp
+++ b/bmc_state_manager.cpp
@@ -141,6 +141,11 @@
     // into the reboot process
     if (server::BMC::Transition::HardReboot == tranReq)
     {
+        // Put BMC state not NotReady when issuing a BMC reboot
+        // and stop monitoring for state changes
+        this->currentBMCState(BMCState::NotReady);
+        this->stateSignal.reset();
+
         auto method = this->bus.new_method_call(
             SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH, SYSTEMD_INTERFACE, "Reboot");
         try
@@ -168,6 +173,11 @@
 
         method.append(sysdUnit, "replace-irreversibly");
 
+        // Put BMC state not NotReady when issuing a BMC reboot
+        // and stop monitoring for state changes
+        this->currentBMCState(BMCState::NotReady);
+        this->stateSignal.reset();
+
         try
         {
             this->bus.call(method);