Sfoglia il codice sorgente

config: Allow use of ring0_addr

Allow ring0_addr to be used in place of 'name' for
backwards compatibility

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 8 anni fa
parent
commit
f5871c6b4c
1 ha cambiato i file con 10 aggiunte e 3 eliminazioni
  1. 10 3
      exec/totemconfig.c

+ 10 - 3
exec/totemconfig.c

@@ -481,7 +481,8 @@ static int nodelist_byname(const char *find_name, int strip_domain)
 		if (res != 2) {
 			continue;
 		}
-		if (strcmp(name_str, "name")) {
+		/* ring0_addr is allowed as a fallback */
+		if (strcmp(name_str, "name") && strcmp(name_str, "ring0_addr")) {
 			continue;
 		}
 		if (icmap_get_string(iter_key, &name) != CS_OK) {
@@ -683,7 +684,10 @@ static int find_local_node(int use_cache)
 		if (res != 2) {
 			continue;
 		}
-		if (strcmp(name_str, "name")) {
+		/* 'ring0_addr' is allowed as a fallback, but 'name' will be found first
+		 * because the names are in alpha order.
+		 */
+		if (strcmp(name_str, "name") && strcmp(name_str, "ring0_addr")) {
 			continue;
 		}
 		if (icmap_get_string(iter_key, &dbnodename) != CS_OK) {
@@ -853,6 +857,8 @@ static int check_for_duplicate_nodeids(
 
 		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", node_pos);
 		autogenerated = 0;
+
+		/* Generated nodeids are only allowed for UDP/UDPU so ring0_addr is valid here */
 		if (icmap_get_uint32(tmp_key, &nodeid) != CS_OK) {
 
 			snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring0_addr", node_pos);
@@ -1574,7 +1580,8 @@ extern int totem_config_read (
 	/*
 	 * Check existence of nodelist
 	 */
-	if (icmap_get_string("nodelist.node.0.name", &str) == CS_OK) {
+	if ((icmap_get_string("nodelist.node.0.name", &str) == CS_OK) ||
+	    (icmap_get_string("nodelist.node.0.ring0_addr", &str) == CS_OK)) {
 		free(str);
 		/*
 		 * find local node