BMC: Block BMC reboots during Code Update

- Enable the service that blocks reboot within the constructor
  of ActivationBlockTransition, so that the user can't reboot BMC
  while code update is in progress.
- Once the code update is complete the destructor of
  ActivationBlockTransition will disable any reboot guard that
  prevents user from rebooting the BMC.

Tested: Verified that the user is unable to reboot during the activation
process and that journal logs are present to indicate why the user is
unable to reboot.

Resolves openbmc/openbmc#1944

Change-Id: Ia149a76bcf093b011fe243fc609ae83358a0f933
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/activation.hpp b/activation.hpp
index c62b747..b2b9aec 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -134,12 +134,14 @@
         {
             std::vector<std::string> interfaces({interface});
             bus.emit_interfaces_added(path.c_str(), interfaces);
+            enableRebootGuard();
         }
 
         ~ActivationBlocksTransition()
         {
             std::vector<std::string> interfaces({interface});
             bus.emit_interfaces_removed(path.c_str(), interfaces);
+            disableRebootGuard();
         }
 
     private:
@@ -148,6 +150,12 @@
                 "xyz.openbmc_project.Software.ActivationBlocksTransition";
         sdbusplus::bus::bus& bus;
         std::string path;
+
+        /** @brief Enables a Guard that blocks any BMC reboot commands */
+        void enableRebootGuard();
+
+        /** @brief Disables any guard that was blocking the BMC reboot */
+        void disableRebootGuard();
 };
 
 class ActivationProgress : public ActivationProgressInherit