Parcourir la source

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>
Jan Friesse il y a 11 ans
Parent
commit
bb52fc2774
3 fichiers modifiés avec 23 ajouts et 0 suppressions
  1. 1 0
      exec/main.c
  2. 14 0
      exec/totemconfig.c
  3. 8 0
      man/cmap_keys.8

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

+ 14 - 0
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);

+ 8 - 0
man/cmap_keys.8

@@ -131,6 +131,14 @@ contains the total number of interrupted sends.
 .B service_id
 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