mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
ctdb-daemon: New function ctdb_tunables_load()
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
b14f2a205d
commit
a509ee059e
@ -965,6 +965,7 @@ int32_t ctdb_control_get_tunable(struct ctdb_context *ctdb, TDB_DATA indata,
|
||||
int32_t ctdb_control_set_tunable(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
int32_t ctdb_control_list_tunables(struct ctdb_context *ctdb,
|
||||
TDB_DATA *outdata);
|
||||
bool ctdb_tunables_load(struct ctdb_context *ctdb);
|
||||
|
||||
/* from ctdb_tunnel.c */
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "common/common.h"
|
||||
#include "common/logging.h"
|
||||
#include "common/path.h"
|
||||
#include "common/tunable.h"
|
||||
|
||||
/*
|
||||
@ -138,3 +139,32 @@ int32_t ctdb_control_list_tunables(struct ctdb_context *ctdb, TDB_DATA *outdata)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ctdb_tunables_load(struct ctdb_context *ctdb)
|
||||
{
|
||||
bool status;
|
||||
TALLOC_CTX *tmp_ctx;
|
||||
char *file = NULL;
|
||||
|
||||
/* Fail by default */
|
||||
status = false;
|
||||
|
||||
tmp_ctx = talloc_new(ctdb);
|
||||
if (tmp_ctx == NULL) {
|
||||
DBG_ERR("Memory allocation error\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
file = path_etcdir_append(tmp_ctx, "ctdb.tunables");
|
||||
if (file == NULL) {
|
||||
D_ERR("Failed to construct path for ctdb.tunables\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ctdb_tunable_load_file(tmp_ctx, &ctdb->tunable, file);
|
||||
/* No need to log error, already logged above */
|
||||
|
||||
done:
|
||||
talloc_free(tmp_ctx);
|
||||
return status;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user