From 666a4113fa71d2f7501c28f4e5e76ba10c051e45 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Thu, 20 Mar 2025 16:08:26 +0100
Subject: [PATCH 5/8] Fix: pacemaker-attrd: remember names of peers from
 attribute update in case unknown

... in the membership cache, so that we also learn names of non-writers
as early as possible through processing `sync-response` from the writer.

Regression introduced by 85d7a70916 (not yet released).
---
 daemons/attrd/attrd_corosync.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
index 4c58c14d22..370f96e548 100644
--- a/daemons/attrd/attrd_corosync.c
+++ b/daemons/attrd/attrd_corosync.c
@@ -325,8 +325,13 @@ update_attr_on_host(attribute_t *a, const pcmk__node_status_t *peer,
     // Remember node's XML ID if we're just learning it
     if ((node_xml_id != NULL)
         && !pcmk__str_eq(node_xml_id, prev_xml_id, pcmk__str_none)) {
+        // Remember node's name in case unknown in the membership cache
+        pcmk__node_status_t *known_peer =
+            pcmk__get_node(0, host, node_xml_id,
+                           pcmk__node_search_cluster_member);
+
         crm_trace("Learned %s[%s] node XML ID is %s (was %s)",
-                  a->id, v->nodename, node_xml_id,
+                  a->id, known_peer->name, node_xml_id,
                   pcmk__s(prev_xml_id, "unknown"));
         attrd_set_node_xml_id(v->nodename, node_xml_id);
         if (attrd_election_won()) {
-- 
2.43.0

