Blame SOURCES/bz720543-pcmk-corosync_attempt_to_retrieve_a_peer_s_node_name_if_it_is_not_already_known.patch

7100e8
commit bcd7ef60b00462c6a55ae1ce2f3ea45391059368
7100e8
Author: Andrew Beekhof <andrew@beekhof.net>
7100e8
Date:   Thu Nov 14 11:25:20 2013 +1100
7100e8
7100e8
    Bug cl#5179 - Corosync: Attempt to retrieve a peer's node name if it is not already known
7100e8
    
7100e8
    (cherry picked from commit 441978e42a41fcfca3f4b41a1458d8a9c171dd63)
7100e8
7100e8
diff --git a/lib/cluster/membership.c b/lib/cluster/membership.c
7100e8
index e7d5b69..b4c8ba7 100644
7100e8
--- a/lib/cluster/membership.c
7100e8
+++ b/lib/cluster/membership.c
7100e8
@@ -270,6 +270,7 @@ crm_get_peer(unsigned int id, const char *uname)
7100e8
     crm_node_t *node = NULL;
7100e8
     crm_node_t *by_id = NULL;
7100e8
     crm_node_t *by_name = NULL;
7100e8
+    char *uname_lookup = NULL;
7100e8
 
7100e8
     CRM_ASSERT(id > 0 || uname != NULL);
7100e8
 
7100e8
@@ -357,6 +358,12 @@ crm_get_peer(unsigned int id, const char *uname)
7100e8
         g_hash_table_replace(crm_peer_cache, uniqueid, node);
7100e8
     }
7100e8
 
7100e8
+    if(id && uname == NULL && node->uname == NULL) {
7100e8
+        uname_lookup = get_node_name(id);
7100e8
+        uname = uname_lookup;
7100e8
+        crm_trace("Inferred a name of '%s' for node %u", uname, id);
7100e8
+    }
7100e8
+
7100e8
     if(id > 0 && uname && (node->id == 0 || node->uname == NULL)) {
7100e8
         crm_info("Node %u is now known as %s", id, uname);
7100e8
     }
7100e8
@@ -393,6 +400,7 @@ crm_get_peer(unsigned int id, const char *uname)
7100e8
         }
7100e8
     }
7100e8
 
7100e8
+    free(uname_lookup);
7100e8
     return node;
7100e8
 }
7100e8