summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-10-24 15:54:08 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-11-01 12:21:29 +0100
commit31d97bce8f113276bf73c7d4349f720cd5edbcb8 (patch)
tree997aa923894d301c53cfb03eb444bfc1c9fb2af3
parentf147633e5d0e64079871060e276c2291d0131bc4 (diff)
downloadsssd-31d97bce8f113276bf73c7d4349f720cd5edbcb8.tar.gz
sssd-31d97bce8f113276bf73c7d4349f720cd5edbcb8.tar.bz2
sssd-31d97bce8f113276bf73c7d4349f720cd5edbcb8.zip
Monitor: read the correct SIGKILL timeout for providers, too
https://fedorahosted.org/sssd/ticket/1602
-rw-r--r--src/monitor/monitor.c74
1 files changed, 41 insertions, 33 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index af2189c7..eef2fc70 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -884,6 +884,42 @@ int get_monitor_config(struct mt_ctx *ctx)
return EOK;
}
+static errno_t get_ping_config(struct mt_ctx *ctx, const char *path,
+ struct mt_svc *svc)
+{
+ errno_t ret;
+
+ ret = confdb_get_int(ctx->cdb, path,
+ CONFDB_DOMAIN_TIMEOUT,
+ MONITOR_DEF_PING_TIME, &svc->ping_time);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Failed to get ping timeout for '%s'\n", svc->name));
+ return ret;
+ }
+
+ /* 'timeout = 0' should be translated to the default */
+ if (svc->ping_time == 0) {
+ svc->ping_time = MONITOR_DEF_PING_TIME;
+ }
+
+ ret = confdb_get_int(ctx->cdb, path,
+ CONFDB_SERVICE_FORCE_TIMEOUT,
+ MONITOR_DEF_FORCE_TIME, &svc->kill_time);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Failed to get kill timeout for %s\n", svc->name));
+ return ret;
+ }
+
+ /* 'force_timeout = 0' should be translated to the default */
+ if (svc->kill_time == 0) {
+ svc->kill_time = MONITOR_DEF_FORCE_TIME;
+ }
+
+ return EOK;
+}
+
static int get_service_config(struct mt_ctx *ctx, const char *name,
struct mt_svc **svc_cfg)
{
@@ -981,36 +1017,14 @@ static int get_service_config(struct mt_ctx *ctx, const char *name,
}
}
- ret = confdb_get_int(ctx->cdb, path,
- CONFDB_SERVICE_TIMEOUT,
- MONITOR_DEF_PING_TIME, &svc->ping_time);
- if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- ("Failed to get ping timeout for %s\n", svc->name));
- talloc_free(svc);
- return ret;
- }
-
- /* 'timeout = 0' should be translated to the default */
- if (svc->ping_time == 0) {
- svc->ping_time = MONITOR_DEF_PING_TIME;
- }
-
- ret = confdb_get_int(ctx->cdb, path,
- CONFDB_SERVICE_FORCE_TIMEOUT,
- MONITOR_DEF_FORCE_TIME, &svc->kill_time);
+ ret = get_ping_config(ctx, path, svc);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Failed to get kill timeout for %s\n", svc->name));
+ ("Failed to get ping timeouts for %s\n", svc->name));
talloc_free(svc);
return ret;
}
- /* 'force_timeout = 0' should be translated to the default */
- if (svc->kill_time == 0) {
- svc->kill_time = MONITOR_DEF_FORCE_TIME;
- }
-
svc->last_restart = now;
*svc_cfg = svc;
@@ -1096,20 +1110,14 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
return ret;
}
- ret = confdb_get_int(ctx->cdb, path,
- CONFDB_DOMAIN_TIMEOUT,
- MONITOR_DEF_PING_TIME, &svc->ping_time);
+ ret = get_ping_config(ctx, path, svc);
if (ret != EOK) {
- DEBUG(0,("Failed to start service '%s'\n", svc->name));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Failed to get ping timeouts for %s\n", svc->name));
talloc_free(svc);
return ret;
}
- /* 'timeout = 0' should be translated to the default */
- if (svc->ping_time == 0) {
- svc->ping_time = MONITOR_DEF_PING_TIME;
- }
-
talloc_free(path);
/* if no provider is present do not run the domain */