Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 1 | #include <logging.hpp> |
| 2 | #include <sdbusplus/bus.hpp> |
| 3 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 4 | namespace attn |
| 5 | { |
| 6 | |
| 7 | /** @brief Start host diagnostic mode systemd unit */ |
| 8 | void tiHandler() |
| 9 | { |
| 10 | // trace message |
Ben Tyner | 9dbab8b | 2020-03-31 08:55:23 -0500 | [diff] [blame^] | 11 | log<level::INFO>("start host diagnostic mode service"); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 12 | |
| 13 | // Use the systemd service manager object interface to call the start unit |
| 14 | // method with the obmc-host-diagnostic-mode target. |
| 15 | auto bus = sdbusplus::bus::new_system(); |
| 16 | auto method = bus.new_method_call( |
| 17 | "org.freedesktop.systemd1", "/org/freedesktop/systemd1", |
| 18 | "org.freedesktop.systemd1.Manager", "StartUnit"); |
| 19 | |
| 20 | method.append("obmc-host-diagnostic-mode@0.target"); // unit to activate |
| 21 | method.append("replace"); // mode = replace conflicting queued jobs |
| 22 | bus.call_noreply(method); // start the service |
| 23 | |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | } // namespace attn |