xref: /openbmc/phosphor-state-manager/hypervisor_state_manager_main.cpp (revision 2eb6029cd9696b1db92c59e85a6752ac4ba4a5a0)
1fe270d35SAndrew Geissler #include "config.h"
2fe270d35SAndrew Geissler 
3fe270d35SAndrew Geissler #include "hypervisor_state_manager.hpp"
4fe270d35SAndrew Geissler 
5fe270d35SAndrew Geissler #include <sdbusplus/bus.hpp>
6fe270d35SAndrew Geissler 
7fe270d35SAndrew Geissler #include <cstdlib>
8fe270d35SAndrew Geissler 
9*2eb6029cSAmithash Prasasd using HostState = sdbusplus::server::xyz::openbmc_project::state::Host;
10*2eb6029cSAmithash Prasasd 
main()11fe270d35SAndrew Geissler int main()
12fe270d35SAndrew Geissler {
13fe270d35SAndrew Geissler     auto bus = sdbusplus::bus::new_default();
14fe270d35SAndrew Geissler 
15fe270d35SAndrew Geissler     // For now, we only have one instance of the hypervisor
16fe270d35SAndrew Geissler     auto objPathInst = std::string{HYPERVISOR_OBJPATH} + '0';
17fe270d35SAndrew Geissler 
18fe270d35SAndrew Geissler     // Add sdbusplus ObjectManager.
19*2eb6029cSAmithash Prasasd     sdbusplus::server::manager_t objManager(bus,
20*2eb6029cSAmithash Prasasd                                             HostState::namespace_path::value);
21fe270d35SAndrew Geissler 
22fe270d35SAndrew Geissler     phosphor::state::manager::Hypervisor manager(bus, objPathInst.c_str());
23fe270d35SAndrew Geissler 
24fe270d35SAndrew Geissler     bus.request_name(HYPERVISOR_BUSNAME);
25fe270d35SAndrew Geissler 
26fe270d35SAndrew Geissler     while (true)
27fe270d35SAndrew Geissler     {
28fe270d35SAndrew Geissler         bus.process_discard();
29fe270d35SAndrew Geissler         bus.wait();
30fe270d35SAndrew Geissler     }
31fe270d35SAndrew Geissler     return 0;
32fe270d35SAndrew Geissler }
33