summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-10-24 15:54:08 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-11-05 00:14:06 +0100
commit09a45954fe790a623099e813bfc2a7cf6b0b57c7 (patch)
tree2e9db4e6783265d8fea972dfa1fb0f1262ebbcd8
parent6436bba0fa2f74f68d46e38a35894139a9778f76 (diff)
downloadsssd-09a45954fe790a623099e813bfc2a7cf6b0b57c7.tar.gz
sssd-09a45954fe790a623099e813bfc2a7cf6b0b57c7.tar.xz
sssd-09a45954fe790a623099e813bfc2a7cf6b0b57c7.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 a5653999e..e6da990d2 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 */