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