Quellcode durchsuchen

Use nodeid provided in nodelist

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Jan Friesse vor 14 Jahren
Ursprung
Commit
16007acbef
3 geänderte Dateien mit 20 neuen und 4 gelöschten Zeilen
  1. 10 2
      exec/main.c
  2. 9 2
      exec/totemconfig.c
  3. 1 0
      exec/totemconfig.h

+ 10 - 2
exec/main.c

@@ -1150,11 +1150,19 @@ int main (int argc, char **argv, char **envp)
 	}
 
 	if (totem_config_warnings & TOTEM_CONFIG_WARNING_MEMBERS_IGNORED) {
-		log_printf (LOGSYS_LEVEL_WARNING, "member section is used together with nodelist. members ignored");
+		log_printf (LOGSYS_LEVEL_WARNING, "member section is used together with nodelist. Members ignored.");
 	}
 
 	if (totem_config_warnings & TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED) {
-		log_printf (LOGSYS_LEVEL_WARNING, "member section is deprecated. Please migrate config file to nodelist");
+		log_printf (LOGSYS_LEVEL_WARNING, "member section is deprecated.");
+	}
+
+	if (totem_config_warnings & TOTEM_CONFIG_WARNING_NODEID_IGNORED) {
+		log_printf (LOGSYS_LEVEL_WARNING, "nodeid in totem section is deprecated and ignored.");
+	}
+
+	if (totem_config_warnings != 0) {
+		log_printf (LOGSYS_LEVEL_WARNING, "Please migrate config file to nodelist.");
 	}
 
 	res = totem_config_keyread (&totem_config, &error_string);

+ 9 - 2
exec/totemconfig.c

@@ -326,6 +326,7 @@ extern int totem_config_read (
 	char tmp_key[ICMAP_KEYNAME_MAXLEN];
 	uint8_t u8;
 	uint16_t u16;
+	uint32_t u32;
 	char *cluster_name = NULL;
 	int i;
 	int local_node_pos;
@@ -368,9 +369,12 @@ extern int totem_config_read (
 	}
 
 	/*
-	 * Get interface node id
+	 * Get interface node id. This is now deprecated, so set warning
+	 * flag if item exists.
 	 */
-	icmap_get_uint32("totem.nodeid", &totem_config->node_id);
+	if (icmap_get_uint32("totem.nodeid", &u32) == CS_OK) {
+		*warnings |= TOTEM_CONFIG_WARNING_NODEID_IGNORED;
+	}
 
 	totem_config->clear_node_high_bit = 0;
 	if (icmap_get_string("totem.clear_node_high_bit", &str) == CS_OK) {
@@ -535,6 +539,9 @@ extern int totem_config_read (
 		local_node_pos = find_local_node_in_nodelist(totem_config);
 		if (local_node_pos != -1) {
 			icmap_set_uint32("nodelist.local_node_pos", local_node_pos);
+
+			snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", local_node_pos);
+			icmap_get_uint32(tmp_key, &totem_config->node_id);
 		}
 
 		put_nodelist_members_to_config(totem_config);

+ 1 - 0
exec/totemconfig.h

@@ -45,6 +45,7 @@
 
 #define TOTEM_CONFIG_WARNING_MEMBERS_IGNORED		(1<<1)
 #define TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED		(1<<2)
+#define TOTEM_CONFIG_WARNING_NODEID_IGNORED		(1<<3)
 
 extern int totem_config_read (
 	struct totem_config *totem_config,