summaryrefslogtreecommitdiffstats
path: root/control
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-05-09 13:06:28 -0500
committerMatthew Barth <msbarth@linux.ibm.com>2018-05-17 17:08:06 +0000
commit2029106af90bcdfd6a640a21c2c2eff36cb95f67 (patch)
tree015a8f6e2480d4336a551b8a0cdf5d6e1b077d4c /control
parent803d35bce81427bc82e999c45174fc2e9b6c3871 (diff)
downloadphosphor-fan-presence-2029106af90bcdfd6a640a21c2c2eff36cb95f67.tar.gz
phosphor-fan-presence-2029106af90bcdfd6a640a21c2c2eff36cb95f67.zip
Use shared callMethod function in control manager
To better handle exit/restart of the fan control application use the shared callMethod function to call systemd's startunit on the fan control ready target. This allows the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: StartUnit on fan control ready target works the same Change-Id: Idce2d8831b4e8de0ef181a0849587e465419f68c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control')
-rw-r--r--control/manager.cpp28
-rw-r--r--control/manager.hpp5
2 files changed, 8 insertions, 25 deletions
diff --git a/control/manager.cpp b/control/manager.cpp
index a322c10..1078473 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -122,26 +122,14 @@ void Manager::doInit()
delay = sleep(delay);
}
- startFanControlReadyTarget();
-}
-
-
-void Manager::startFanControlReadyTarget()
-{
- auto method = _bus.new_method_call(SYSTEMD_SERVICE,
- SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE,
- "StartUnit");
-
- method.append(FAN_CONTROL_READY_TARGET);
- method.append("replace");
-
- auto response = _bus.call(method);
- if (response.is_method_error())
- {
- log<level::ERR>("Failed to start fan control ready target");
- elog<InternalFailure>();
- }
+ util::SDBusPlus::callMethod(
+ _bus,
+ SYSTEMD_SERVICE,
+ SYSTEMD_OBJ_PATH,
+ SYSTEMD_INTERFACE,
+ "StartUnit",
+ FAN_CONTROL_READY_TARGET,
+ "replace");
}
} // namespace control
diff --git a/control/manager.hpp b/control/manager.hpp
index d5b75fc..d049323 100644
--- a/control/manager.hpp
+++ b/control/manager.hpp
@@ -53,11 +53,6 @@ class Manager
private:
/**
- * Starts the obmc-fan-control-ready dbus target
- */
- void startFanControlReadyTarget();
-
- /**
* The dbus object
*/
sdbusplus::bus::bus& _bus;
OpenPOWER on IntegriCloud