blob: 4801f2c3bd250c16aec80931a3629aa7c7f5bc51 [file] [log] [blame]
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05001#include <attn_logging.hpp>
Ben Tyner9ae5ca42020-02-28 13:13:50 -06002#include <sdbusplus/bus.hpp>
3
Ben Tyner9ae5ca42020-02-28 13:13:50 -06004namespace attn
5{
6
7/** @brief Start host diagnostic mode systemd unit */
8void tiHandler()
9{
10 // trace message
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050011 trace<level::INFO>("start host diagnostic mode service");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060012
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