From fec6bfd34165daf54e162c3dde31e7d3605d5fda Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 13 Nov 2018 17:32:43 +0100 Subject: [PATCH] main: Remove COROSYNC_RUN_DIR Remove last used environment variable (reasons similar to removal of COROSYNC_MAIN_CONFIG_FILE). This environment variable was never documented, so document it properly. Signed-off-by: Jan Friesse Reviewed-by: Christine Caulfield --- exec/cfg.c | 1 + exec/util.c | 10 +++++----- exec/util.h | 2 +- man/corosync.conf.5 | 7 +++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/exec/cfg.c b/exec/cfg.c index 77a4445e..19b819eb 100644 --- a/exec/cfg.c +++ b/exec/cfg.c @@ -597,6 +597,7 @@ static void remove_ro_entries(icmap_map_t temp_map) delete_and_notify_if_changed(temp_map, "system.sched_rr"); delete_and_notify_if_changed(temp_map, "system.priority"); delete_and_notify_if_changed(temp_map, "system.qb_ipc_type"); + delete_and_notify_if_changed(temp_map, "system.run_dir"); } /* diff --git a/exec/util.c b/exec/util.c index 9e2ab57b..57b9fa54 100644 --- a/exec/util.c +++ b/exec/util.c @@ -45,6 +45,7 @@ #include #include +#include #include #include "util.h" @@ -171,14 +172,13 @@ int cs_name_tisEqual (cs_name_t *str1, char *str2) { const char *get_run_dir(void) { static char path[PATH_MAX] = {'\0'}; - char *env_run_dir; + char *cmap_run_dir; int res; if (path[0] == '\0') { - env_run_dir = getenv("COROSYNC_RUN_DIR"); - - if (env_run_dir != NULL && env_run_dir[0] != '\0') { - res = snprintf(path, PATH_MAX, "%s", getenv("COROSYNC_RUN_DIR")); + if (icmap_get_string("system.run_dir", &cmap_run_dir) == CS_OK) { + res = snprintf(path, PATH_MAX, "%s", cmap_run_dir); + free(cmap_run_dir); } else { res = snprintf(path, PATH_MAX, "%s/%s", LOCALSTATEDIR, "lib/corosync"); } diff --git a/exec/util.h b/exec/util.h index 142e21ef..9e90cc80 100644 --- a/exec/util.h +++ b/exec/util.h @@ -83,7 +83,7 @@ const char * short_service_name_get(uint32_t service_id, char *buf, size_t buf_size); /* - * Return run directory (ether COROSYNC_RUN_DIR env or LOCALSTATEDIR/lib/corosync) + * Return run directory (ether icmap system.run_dir or LOCALSTATEDIR/lib/corosync) */ const char *get_run_dir(void); diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 index 9ed59af0..c997d384 100644 --- a/man/corosync.conf.5 +++ b/man/corosync.conf.5 @@ -748,6 +748,13 @@ Should be set to yes (default) if corosync should try to move itself to root cgroup. This feature is available only for systems with cgroups with RT sched enabled (Linux with CONFIG_RT_GROUP_SCHED kernel option). +.TP +run_dir +Existing directory where corosync should chdir into. Corosync stores +important state files and blackboxes there. + +The default is /var/lib/corosync. + .PP Within the .B resources