hypervisor: state management support
Some systems have a hypervisor firmware stack which they wish to track
and change the state of. This new state management object will provide
this function if a user selects to bring it into their system.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I6082c6e06c6731d71f2e580e1ab87af38917bb3a
diff --git a/hypervisor_state_manager.hpp b/hypervisor_state_manager.hpp
new file mode 100644
index 0000000..b0ce297
--- /dev/null
+++ b/hypervisor_state_manager.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include "config.h"
+
+#include "settings.hpp"
+#include "xyz/openbmc_project/State/Host/server.hpp"
+
+#include <sdbusplus/bus.hpp>
+
+namespace phosphor
+{
+namespace state
+{
+namespace manager
+{
+
+using HypervisorInherit = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::State::server::Host>;
+
+namespace server = sdbusplus::xyz::openbmc_project::State::server;
+
+/** @class Host
+ * @brief OpenBMC host state management implementation.
+ * @details A concrete implementation for xyz.openbmc_project.State.Host
+ * DBus API.
+ */
+class Hypervisor : public HypervisorInherit
+{
+ public:
+ Hypervisor() = delete;
+ Hypervisor(const Hypervisor&) = delete;
+ Hypervisor& operator=(const Hypervisor&) = delete;
+ Hypervisor(Hypervisor&&) = delete;
+ Hypervisor& operator=(Hypervisor&&) = delete;
+ virtual ~Hypervisor() = default;
+
+ /** @brief Constructs Hypervisor State Manager
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] objPath - The Dbus object path
+ */
+ Hypervisor(sdbusplus::bus::bus& bus, const char* objPath) :
+ HypervisorInherit(bus, objPath, false), bus(bus)
+ {}
+
+ /** @brief Set value of HostTransition */
+ server::Host::Transition
+ requestedHostTransition(server::Host::Transition value) override;
+
+ /** @brief Set value of CurrentHostState */
+ server::Host::HostState
+ currentHostState(server::Host::HostState value) override;
+
+ private:
+ /** @brief Persistent sdbusplus DBus bus connection. */
+ sdbusplus::bus::bus& bus;
+};
+
+} // namespace manager
+} // namespace state
+} // namespace phosphor