Add persistancy for boot progress and os status

Resolves openbmc/openbmc#2181

Change-Id: I807dd94efcea1118060f8594c7f69e333a3ea682
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index ab60030..8debe8a 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -340,6 +340,20 @@
     return retVal;
 }
 
+Host::ProgressStages Host::bootProgress(ProgressStages value)
+{
+    auto retVal = bootprogress::Progress::bootProgress(value);
+    serialize();
+    return retVal;
+}
+
+Host::OSStatus Host::operatingSystemState(OSStatus value)
+{
+    auto retVal = osstatus::Status::operatingSystemState(value);
+    serialize();
+    return retVal;
+}
+
 Host::HostState Host::currentHostState(HostState value)
 {
     log<level::INFO>("Change to Host State",
diff --git a/host_state_manager.hpp b/host_state_manager.hpp
index a0ba768..35a4bdd 100644
--- a/host_state_manager.hpp
+++ b/host_state_manager.hpp
@@ -80,6 +80,12 @@
         /** @brief Set value of HostTransition */
         Transition requestedHostTransition(Transition value) override;
 
+        /** @brief Set Value for boot progress */
+        ProgressStages bootProgress(ProgressStages value) override;
+
+        /** @brief Set Value for Operating System Status */
+        OSStatus operatingSystemState(OSStatus value) override;
+
         /** @brief Set value of CurrentHostState */
         HostState currentHostState(HostState value) override;
 
@@ -184,7 +190,13 @@
         {
             archive(convertForMessage(sdbusplus::xyz::openbmc_project::
                                       State::server::Host::
-                                      requestedHostTransition()));
+                                      requestedHostTransition()),
+                    convertForMessage(sdbusplus::xyz::openbmc_project::
+                                      State::Boot::server::Progress::
+                                      bootProgress()),
+                    convertForMessage(sdbusplus::xyz::openbmc_project::
+                                      State::OperatingSystem::server::Status::
+                                      operatingSystemState()));
         }
 
         /** @brief Function required by Cereal to perform deserialization.
@@ -195,13 +207,21 @@
         template<class Archive>
         void load(Archive& archive)
         {
-            std::string str;
-            archive(str);
-            auto reqTran = Host::convertTransitionFromString(str);
+            std::string reqTranState;
+            std::string bootProgress;
+            std::string osState;
+            archive(reqTranState, bootProgress, osState);
+            auto reqTran = Host::convertTransitionFromString(reqTranState);
             // When restoring, set the requested state with persistent value
             // but don't call the override which would execute it
             sdbusplus::xyz::openbmc_project::State::server::Host::
                 requestedHostTransition(reqTran);
+            sdbusplus::xyz::openbmc_project::State::Boot::server::Progress::
+                bootProgress(
+                    Host::convertProgressStagesFromString(bootProgress));
+            sdbusplus::xyz::openbmc_project::State::OperatingSystem::server::
+                Status::operatingSystemState(
+                    Host::convertOSStatusFromString(osState));
         }
 
         /** @brief Serialize and persist requested host state