From a6718479a04f50107e1fa6dc5ba00012c06a6ef6 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 21 Mar 2025 16:03:41 +0100
Subject: [PATCH 8/8] Fix: pacemaker-attrd: make a peer learn our node name
 once it has joined

... by sending it a protocol message.

This is an additional assurance besides the way of learning non-writers'
names through processing `sync-response` from the writer as of
666a4113fa.
---
 daemons/attrd/attrd_corosync.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
index 370f96e548..e681fb24d4 100644
--- a/daemons/attrd/attrd_corosync.c
+++ b/daemons/attrd/attrd_corosync.c
@@ -192,10 +192,16 @@ attrd_peer_change_cb(enum pcmk__node_update kind, pcmk__node_status_t *peer,
                 /* If we're the writer, send new peers a list of all attributes
                  * (unless it's a remote node, which doesn't run its own attrd)
                  */
-                if (attrd_election_won()
-                    && !pcmk_is_set(peer->flags, pcmk__node_status_remote)) {
-                    attrd_peer_sync(peer);
+                if (!is_remote) {
+                   if (attrd_election_won()) {
+                       attrd_peer_sync(peer);
+
+                   } else {
+                       // Anyway send a message so that the peer learns our name
+                       attrd_send_protocol(peer);
+                   }
                 }
+
             } else {
                 // Remove all attribute values associated with lost nodes
                 if (peer->name != NULL) {
-- 
2.43.0

