summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/data_provider_fo.c19
-rw-r--r--src/providers/dp_backend.h1
-rw-r--r--src/providers/fail_over.c30
-rw-r--r--src/providers/fail_over.h2
4 files changed, 42 insertions, 10 deletions
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index 41d70de06..cd57340a0 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -743,6 +743,25 @@ void reset_fo(struct be_ctx *be_ctx)
fo_reset_services(be_ctx->be_fo->fo_ctx);
}
+void be_fo_reset_svc(struct be_ctx *be_ctx,
+ const char *svc_name)
+{
+ struct fo_service *service;
+ int ret;
+
+ DEBUG(SSSDBG_TRACE_LIBS,
+ "Resetting all servers in service %s\n", svc_name);
+
+ ret = fo_get_service(be_ctx->be_fo->fo_ctx, svc_name, &service);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ "Cannot retrieve service [%s]\n", svc_name);
+ return;
+ }
+
+ fo_reset_servers(service);
+}
+
void _be_fo_set_port_status(struct be_ctx *ctx,
const char *service_name,
struct fo_server *server,
diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h
index 4bffcee9e..0ced851be 100644
--- a/src/providers/dp_backend.h
+++ b/src/providers/dp_backend.h
@@ -283,6 +283,7 @@ int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx,
const char *service_name);
void reset_fo(struct be_ctx *be_ctx);
+void be_fo_reset_svc(struct be_ctx *be_ctx, const char *svc_name);
errno_t be_res_init(struct be_ctx *ctx);
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 6d835ae0e..562f0b3fd 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -1547,21 +1547,31 @@ time_t fo_get_service_retry_timeout(struct fo_service *svc)
return svc->ctx->opts->retry_timeout;
}
+void fo_reset_servers(struct fo_service *service)
+{
+ struct fo_server *server;
+
+ DLIST_FOR_EACH(server, service->server_list) {
+ if (server->srv_data != NULL) {
+ set_srv_data_status(server->srv_data, SRV_NEUTRAL);
+ } else {
+ fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED);
+ }
+
+ fo_set_port_status(server, PORT_NEUTRAL);
+ }
+}
+
+
void fo_reset_services(struct fo_ctx *fo_ctx)
{
struct fo_service *service;
- struct fo_server *server;
- DLIST_FOR_EACH(service, fo_ctx->service_list) {
- DLIST_FOR_EACH(server, service->server_list) {
- if (server->srv_data != NULL) {
- set_srv_data_status(server->srv_data, SRV_NEUTRAL);
- } else {
- fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED);
- }
+ DEBUG(SSSDBG_TRACE_LIBS,
+ "Resetting all servers in all services\n");
- fo_set_port_status(server, PORT_NEUTRAL);
- }
+ DLIST_FOR_EACH(service, fo_ctx->service_list) {
+ fo_reset_servers(service);
}
}
diff --git a/src/providers/fail_over.h b/src/providers/fail_over.h
index d44ad2ff1..e49c6414a 100644
--- a/src/providers/fail_over.h
+++ b/src/providers/fail_over.h
@@ -198,6 +198,8 @@ time_t fo_get_service_retry_timeout(struct fo_service *svc);
void fo_reset_services(struct fo_ctx *fo_ctx);
+void fo_reset_servers(struct fo_service *svc);
+
bool fo_svc_has_server(struct fo_service *service, struct fo_server *server);
/*