summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-01-08 15:17:09 -0800
committerTom Joseph <tomjoseph@in.ibm.com>2018-01-24 20:15:00 +0000
commit5325f2cba7154825c8c887bc099f01b35c70279f (patch)
tree352442238ec09e9f438981b0f83616f3100a06b2 /app
parenta9fbff43d2e63ac9b4695ae988dd3100b4acfb29 (diff)
downloadphosphor-host-ipmid-5325f2cba7154825c8c887bc099f01b35c70279f.zip
phosphor-host-ipmid-5325f2cba7154825c8c887bc099f01b35c70279f.tar.gz
watchdog: Implement error on reset of disabled watchdog
This enables the host to recover when the BMC resets or the daemon loses state for some reason. A well formed host will resend the SetTimeout command if it encounters this error code. Change-Id: Ib5fd50ac3ad83ef820f0209354aa8f084a563995 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'app')
-rw-r--r--app/watchdog.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index 84e8426..7b04faa 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -124,7 +124,8 @@ ipmi_ret_t ipmi_app_reset_watchdog(
int r = 0;
char *busname = NULL;
- // Current time interval that is set in watchdog.
+ // Current properties of the watchdog daemon.
+ bool enabled = false;
uint64_t interval = 0;
// Status code.
@@ -140,6 +141,34 @@ ipmi_ret_t ipmi_app_reset_watchdog(
goto finish;
}
+ // Check if our watchdog is running
+ r = sd_bus_call_method(bus, busname, objname, property_iface,
+ "Get", &error, &reply, "ss",
+ iface, "Enabled");
+ if(r < 0) {
+ fprintf(stderr, "Failed to get current Enabled msg: %s\n",
+ strerror(-r));
+ goto finish;
+ }
+
+ // Now extract the value
+ r = sd_bus_message_read(reply, "v", "b", &enabled);
+ if (r < 0) {
+ fprintf(stderr, "Failed to read current Enabled: %s\n",
+ strerror(-r));
+ goto finish;
+ }
+
+ // If we are not enable we should indicate that
+ if (!enabled) {
+ printf("Watchdog not enabled during reset\n");
+ rc = IPMI_WDOG_CC_NOT_INIT;
+ goto finish;
+ }
+
+ sd_bus_error_free(&error);
+ reply = sd_bus_message_unref(reply);
+
// Get the current interval and set it back.
r = sd_bus_call_method(bus, busname, objname, property_iface,
"Get", &error, &reply, "ss",
OpenPOWER on IntegriCloud