File bsc#1180618-0002-Fix-controller-ensure-newly-joining-node-learns-the-.patch of Package pacemaker.26124

From a2191a46561356f674898a7a6ff9ddca4cfafe4c Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Tue, 10 Aug 2021 17:03:27 +0200
Subject: [PATCH] Fix: controller: ensure newly joining node learns the node
 names of none-DCs

Commit 0ec714adc covers the case where a node is rejoining. But for the
case where a node is newly joining controld cpg group, hence its node
name is not known by us yet, peer_update_callback() will directly bail
out with the logic:

```
    if (node->uname == NULL) {
        return;
    }
```
, so that non-DC nodes don't get to send out a hello message.

This commit fixes it by moving the hello messaging logic prior to that.
---
 daemons/controld/controld_callbacks.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

Index: pacemaker-2.0.4+20200616.2deceaa3a/daemons/controld/controld_callbacks.c
===================================================================
--- pacemaker-2.0.4+20200616.2deceaa3a.orig/daemons/controld/controld_callbacks.c
+++ pacemaker-2.0.4+20200616.2deceaa3a/daemons/controld/controld_callbacks.c
@@ -114,6 +114,22 @@ peer_update_callback(enum crm_status_typ
         set_bit(fsa_input_register, R_PEER_DATA);
     }
 
+    if (type == crm_status_processes
+        && is_set(node->processes, crm_get_cluster_proc())
+        && !AM_I_DC
+        && !is_remote) {
+        /*
+         * This is a hack until we can send to a nodeid and/or we fix node name lookups
+         * These messages are ignored in crmd_ha_msg_filter()
+         */
+        xmlNode *query = create_request(CRM_OP_HELLO, NULL, NULL, CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
+
+        crm_debug("Sending hello to node %u so that it learns our node name", node->id);
+        send_cluster_message(node, crm_msg_crmd, query, FALSE);
+
+        free_xml(query);
+    }
+
     if (node->uname == NULL) {
         return;
     }
@@ -170,17 +186,6 @@ peer_update_callback(enum crm_status_typ
 
             if (!appeared) {
                 controld_remove_voter(node->uname);
-            } else if (!AM_I_DC && !is_remote) {
-                /*
-                 * This is a hack until we can send to a nodeid and/or we fix node name lookups
-                 * These messages are ignored in crmd_ha_msg_filter()
-                 */
-                xmlNode *query = create_request(CRM_OP_HELLO, NULL, NULL, CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
-
-                crm_debug("Broadcasting our uname because of node %u", node->id);
-                send_cluster_message(node, crm_msg_crmd, query, FALSE);
-
-                free_xml(query);
             }
 
             if (is_not_set(fsa_input_register, R_CIB_CONNECTED)) {
openSUSE Build Service is sponsored by