Blob Blame History Raw
From bb52fc2774ef690d6bb951fe9cc34e5b373caffe Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Mon, 13 Oct 2014 11:58:58 +0200
Subject: [PATCH] Store configuration values used by totem to cmap

Some totem configuration values (like token, consensus, ...) are ether
computed or default value is used. It's hard to find out, what
value is really used.

Solution is to store values in cmap.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
 exec/main.c        |    1 +
 exec/totemconfig.c |   14 ++++++++++++++
 man/cmap_keys.8    |    8 ++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/exec/main.c b/exec/main.c
index 0edd4bf..e423c97 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1061,6 +1061,7 @@ static void set_icmap_ro_keys_flag (void)
 	icmap_set_ro_access("runtime.connections.", CS_TRUE, CS_TRUE);
 	icmap_set_ro_access("runtime.totem.", CS_TRUE, CS_TRUE);
 	icmap_set_ro_access("runtime.services.", CS_TRUE, CS_TRUE);
+	icmap_set_ro_access("runtime.config.", CS_TRUE, CS_TRUE);
 
 	/*
 	 * Set RO flag for constrete keys of configuration which can't be changed
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index abaabdf..daf0719 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -142,12 +142,21 @@ static void totem_volatile_config_set_value (struct totem_config *totem_config,
 	const char *key_name, const char *deleted_key, unsigned int default_value,
 	int allow_zero_value)
 {
+	char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
 
 	if (icmap_get_uint32(key_name, totem_get_param_by_name(totem_config, key_name)) != CS_OK ||
 	    (deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
 	    (!allow_zero_value && *totem_get_param_by_name(totem_config, key_name) == 0)) {
 		*totem_get_param_by_name(totem_config, key_name) = default_value;
 	}
+
+	/*
+	 * Store totem_config value to cmap runtime section
+	 */
+	strcpy(runtime_key_name, "runtime.config.");
+	strcat(runtime_key_name, key_name);
+
+	icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
 }
 
 
@@ -169,6 +178,11 @@ static void totem_volatile_config_read (struct totem_config *totem_config, const
 		u32 = TOKEN_COEFFICIENT;
 		icmap_get_uint32("totem.token_coefficient", &u32);
 		totem_config->token_timeout += (totem_config->interfaces[0].member_count - 2) * u32;
+
+		/*
+		 * Store totem_config value to cmap runtime section
+		 */
+		icmap_set_uint32("runtime.config.totem.token", totem_config->token_timeout);
 	}
 
 	totem_volatile_config_set_value(totem_config, "totem.max_network_delay", deleted_key, MAX_NETWORK_DELAY, 0);
diff --git a/man/cmap_keys.8 b/man/cmap_keys.8
index bda6615..f19d2c9 100644
--- a/man/cmap_keys.8
+++ b/man/cmap_keys.8
@@ -132,6 +132,14 @@ contains the total number of interrupted sends.
 contains the ID of service which the IPC is connected to.
 
 .TP
+runtime.config.*
+Contains the values actually in use by the totem membership protocol.
+Values here are either taken from the Corosync configuration file,
+defaults or computed from entries in the config file. For information
+on individual keys please refer to the man page
+.BR corosync.conf (5).
+
+.TP
 runtime.services.*
 Prefix with statistics for service engines. Each service has it's own
 .B service_id
-- 
1.7.1