[PATCH 1/2] Store configuration values used by totem to cmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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 16b7d46..61a46f8 100644
--- a/man/cmap_keys.8
+++ b/man/cmap_keys.8
@@ -132,6 +132,14 @@ contains total number of interrupted sends.
 contains ID of service which IPC is connected to.
 
 .TP
+runtime.config.*
+Prefix with configuration values used by totem membership protocol.
+Values are ether taken directly from Corosync configuration file or
+default values are used or computed. For each key description, please
+consider look to
+.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

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux