hypervisor: monitor boot progress
The BootProgress property will be tracked to set the hypervisor state as
appropriate
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I5aa5d95893222169bc5abed6b851e795f2ad5ff0
diff --git a/hypervisor_state_manager.hpp b/hypervisor_state_manager.hpp
index b0ce297..9bb3cb2 100644
--- a/hypervisor_state_manager.hpp
+++ b/hypervisor_state_manager.hpp
@@ -18,6 +18,7 @@
sdbusplus::xyz::openbmc_project::State::server::Host>;
namespace server = sdbusplus::xyz::openbmc_project::State::server;
+namespace sdbusRule = sdbusplus::bus::match::rules;
/** @class Host
* @brief OpenBMC host state management implementation.
@@ -40,7 +41,14 @@
* @param[in] objPath - The Dbus object path
*/
Hypervisor(sdbusplus::bus::bus& bus, const char* objPath) :
- HypervisorInherit(bus, objPath, false), bus(bus)
+ HypervisorInherit(bus, objPath, false), bus(bus),
+ bootProgressChangeSignal(
+ bus,
+ sdbusRule::propertiesChanged(
+ "/xyz/openbmc_project/state/host0",
+ "xyz.openbmc_project.State.Boot.Progress"),
+ std::bind(std::mem_fn(&Hypervisor::bootProgressChangeEvent), this,
+ std::placeholders::_1))
{}
/** @brief Set value of HostTransition */
@@ -51,9 +59,32 @@
server::Host::HostState
currentHostState(server::Host::HostState value) override;
+ /** @brief Return value of CurrentHostState */
+ server::Host::HostState currentHostState();
+
+ /** @brief Check if BootProgress change affects hypervisor state
+ *
+ * @param[in] bootProgress - BootProgress value to check
+ *
+ */
+ void updateCurrentHostState(std::string& bootProgress);
+
private:
+ /** @brief Process BootProgress property changes
+ *
+ * Instance specific interface to monitor for changes to the BootProgress
+ * property which may impact Hypervisor state.
+ *
+ * @param[in] msg - Data associated with subscribed signal
+ *
+ */
+ void bootProgressChangeEvent(sdbusplus::message::message& msg);
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
+
+ /** @brief Watch BootProgress changes to know hypervisor state **/
+ sdbusplus::bus::match_t bootProgressChangeSignal;
};
} // namespace manager