Просмотр исходного кода

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 <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 7 лет назад
Родитель
Сommit
fec6bfd341
4 измененных файлов с 14 добавлено и 6 удалено
  1. 1 0
      exec/cfg.c
  2. 5 5
      exec/util.c
  3. 1 1
      exec/util.h
  4. 7 0
      man/corosync.conf.5

+ 1 - 0
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");
 }
 
 /*

+ 5 - 5
exec/util.c

@@ -45,6 +45,7 @@
 
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
+#include <corosync/icmap.h>
 #include <corosync/logsys.h>
 #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");
 		}

+ 1 - 1
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);
 

+ 7 - 0
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