Blame SOURCES/bz1078361-2-Store-configuration-values-used-by-totem-to-cmap.patch

d26a47
From bb52fc2774ef690d6bb951fe9cc34e5b373caffe Mon Sep 17 00:00:00 2001
d26a47
From: Jan Friesse <jfriesse@redhat.com>
d26a47
Date: Mon, 13 Oct 2014 11:58:58 +0200
d26a47
Subject: [PATCH] Store configuration values used by totem to cmap
d26a47
d26a47
Some totem configuration values (like token, consensus, ...) are ether
d26a47
computed or default value is used. It's hard to find out, what
d26a47
value is really used.
d26a47
d26a47
Solution is to store values in cmap.
d26a47
d26a47
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
d26a47
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
d26a47
---
d26a47
 exec/main.c        |    1 +
d26a47
 exec/totemconfig.c |   14 ++++++++++++++
d26a47
 man/cmap_keys.8    |    8 ++++++++
d26a47
 3 files changed, 23 insertions(+), 0 deletions(-)
d26a47
d26a47
diff --git a/exec/main.c b/exec/main.c
d26a47
index 0edd4bf..e423c97 100644
d26a47
--- a/exec/main.c
d26a47
+++ b/exec/main.c
d26a47
@@ -1061,6 +1061,7 @@ static void set_icmap_ro_keys_flag (void)
d26a47
 	icmap_set_ro_access("runtime.connections.", CS_TRUE, CS_TRUE);
d26a47
 	icmap_set_ro_access("runtime.totem.", CS_TRUE, CS_TRUE);
d26a47
 	icmap_set_ro_access("runtime.services.", CS_TRUE, CS_TRUE);
d26a47
+	icmap_set_ro_access("runtime.config.", CS_TRUE, CS_TRUE);
d26a47
 
d26a47
 	/*
d26a47
 	 * Set RO flag for constrete keys of configuration which can't be changed
d26a47
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
d26a47
index abaabdf..daf0719 100644
d26a47
--- a/exec/totemconfig.c
d26a47
+++ b/exec/totemconfig.c
d26a47
@@ -142,12 +142,21 @@ static void totem_volatile_config_set_value (struct totem_config *totem_config,
d26a47
 	const char *key_name, const char *deleted_key, unsigned int default_value,
d26a47
 	int allow_zero_value)
d26a47
 {
d26a47
+	char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
d26a47
 
d26a47
 	if (icmap_get_uint32(key_name, totem_get_param_by_name(totem_config, key_name)) != CS_OK ||
d26a47
 	    (deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
d26a47
 	    (!allow_zero_value && *totem_get_param_by_name(totem_config, key_name) == 0)) {
d26a47
 		*totem_get_param_by_name(totem_config, key_name) = default_value;
d26a47
 	}
d26a47
+
d26a47
+	/*
d26a47
+	 * Store totem_config value to cmap runtime section
d26a47
+	 */
d26a47
+	strcpy(runtime_key_name, "runtime.config.");
d26a47
+	strcat(runtime_key_name, key_name);
d26a47
+
d26a47
+	icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
d26a47
 }
d26a47
 
d26a47
 
d26a47
@@ -169,6 +178,11 @@ static void totem_volatile_config_read (struct totem_config *totem_config, const
d26a47
 		u32 = TOKEN_COEFFICIENT;
d26a47
 		icmap_get_uint32("totem.token_coefficient", &u32);
d26a47
 		totem_config->token_timeout += (totem_config->interfaces[0].member_count - 2) * u32;
d26a47
+
d26a47
+		/*
d26a47
+		 * Store totem_config value to cmap runtime section
d26a47
+		 */
d26a47
+		icmap_set_uint32("runtime.config.totem.token", totem_config->token_timeout);
d26a47
 	}
d26a47
 
d26a47
 	totem_volatile_config_set_value(totem_config, "totem.max_network_delay", deleted_key, MAX_NETWORK_DELAY, 0);
d26a47
diff --git a/man/cmap_keys.8 b/man/cmap_keys.8
d26a47
index bda6615..f19d2c9 100644
d26a47
--- a/man/cmap_keys.8
d26a47
+++ b/man/cmap_keys.8
d26a47
@@ -132,6 +132,14 @@ contains the total number of interrupted sends.
d26a47
 contains the ID of service which the IPC is connected to.
d26a47
 
d26a47
 .TP
d26a47
+runtime.config.*
d26a47
+Contains the values actually in use by the totem membership protocol.
d26a47
+Values here are either taken from the Corosync configuration file,
d26a47
+defaults or computed from entries in the config file. For information
d26a47
+on individual keys please refer to the man page
d26a47
+.BR corosync.conf (5).
d26a47
+
d26a47
+.TP
d26a47
 runtime.services.*
d26a47
 Prefix with statistics for service engines. Each service has it's own
d26a47
 .B service_id
d26a47
-- 
d26a47
1.7.1
d26a47