Matt Spinler | ebf6989 | 2024-05-17 14:56:16 -0500 | [diff] [blame^] | 1 | #include "manager.hpp" |
| 2 | |
| 3 | #include "role_determination.hpp" |
| 4 | |
| 5 | #include <phosphor-logging/lg2.hpp> |
| 6 | |
| 7 | namespace bmc::redundancy |
| 8 | { |
| 9 | |
| 10 | Manager::Manager(sdbusplus::async::context& ctx) : |
| 11 | ctx(ctx), |
| 12 | redundancyInterface(ctx.get_bus(), RedundancyInterface::instance_path) |
| 13 | { |
| 14 | ctx.spawn(startup()); |
| 15 | } |
| 16 | |
| 17 | sdbusplus::async::task<> Manager::startup() |
| 18 | { |
| 19 | determineRole(); |
| 20 | co_return; |
| 21 | } |
| 22 | |
| 23 | void Manager::determineRole() |
| 24 | { |
| 25 | auto role = role_determination::run(); |
| 26 | |
| 27 | lg2::info("Role Determined: {ROLE}", "ROLE", role); |
| 28 | |
| 29 | redundancyInterface.role(role); |
| 30 | } |
| 31 | |
| 32 | } // namespace bmc::redundancy |