Blame SOURCES/001-sync-points.patch

64302d
From de05f6b52c667155d262ceeb541dc1041d079d71 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 8 Sep 2022 11:36:58 -0400
64302d
Subject: [PATCH 01/26] Refactor: tools: Use a uint32_t for attr_options.
64302d
64302d
---
64302d
 tools/attrd_updater.c | 2 +-
64302d
 1 file changed, 1 insertion(+), 1 deletion(-)
64302d
64302d
diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c
64302d
index d90567a..b85a281 100644
64302d
--- a/tools/attrd_updater.c
64302d
+++ b/tools/attrd_updater.c
64302d
@@ -47,7 +47,7 @@ struct {
64302d
     gchar *attr_node;
64302d
     gchar *attr_set;
64302d
     char *attr_value;
64302d
-    int attr_options;
64302d
+    uint32_t attr_options;
64302d
     gboolean query_all;
64302d
     gboolean quiet;
64302d
 } options = {
64302d
-- 
64302d
2.31.1
64302d
64302d
From c6637520b474d44553ade52c0dbe9e36e873135f Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Fri, 21 Oct 2022 14:31:16 -0400
64302d
Subject: [PATCH 02/26] Refactor: libcrmcommon: Make pcmk__xe_match more
64302d
 broadly useful.
64302d
64302d
If attr_v is NULL, simply return the first node with a matching name.
64302d
---
64302d
 lib/common/xml.c | 10 ++++++----
64302d
 1 file changed, 6 insertions(+), 4 deletions(-)
64302d
64302d
diff --git a/lib/common/xml.c b/lib/common/xml.c
64302d
index 036dd87..ac6f46a 100644
64302d
--- a/lib/common/xml.c
64302d
+++ b/lib/common/xml.c
64302d
@@ -510,7 +510,7 @@ find_xml_node(const xmlNode *root, const char *search_path, gboolean must_find)
64302d
  * \param[in] parent     XML element to search
64302d
  * \param[in] node_name  If not NULL, only match children of this type
64302d
  * \param[in] attr_n     If not NULL, only match children with an attribute
64302d
- *                       of this name and a value of \p attr_v
64302d
+ *                       of this name.
64302d
  * \param[in] attr_v     If \p attr_n and this are not NULL, only match children
64302d
  *                       with an attribute named \p attr_n and this value
64302d
  *
64302d
@@ -520,14 +520,16 @@ xmlNode *
64302d
 pcmk__xe_match(const xmlNode *parent, const char *node_name,
64302d
                const char *attr_n, const char *attr_v)
64302d
 {
64302d
-    /* ensure attr_v specified when attr_n is */
64302d
-    CRM_CHECK(attr_n == NULL || attr_v != NULL, return NULL);
64302d
+    CRM_CHECK(parent != NULL, return NULL);
64302d
+    CRM_CHECK(attr_v == NULL || attr_n != NULL, return NULL);
64302d
 
64302d
     for (xmlNode *child = pcmk__xml_first_child(parent); child != NULL;
64302d
          child = pcmk__xml_next(child)) {
64302d
         if (pcmk__str_eq(node_name, (const char *) (child->name),
64302d
                          pcmk__str_null_matches)
64302d
-            && ((attr_n == NULL) || attr_matches(child, attr_n, attr_v))) {
64302d
+            && ((attr_n == NULL) ||
64302d
+                (attr_v == NULL && xmlHasProp(child, (pcmkXmlStr) attr_n)) ||
64302d
+                (attr_v != NULL && attr_matches(child, attr_n, attr_v)))) {
64302d
             return child;
64302d
         }
64302d
     }
64302d
-- 
64302d
2.31.1
64302d
64302d
From dd520579484c6ec091f7fbb550347941302dad0e Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Fri, 21 Oct 2022 14:32:46 -0400
64302d
Subject: [PATCH 03/26] Tests: libcrmcommon: Add tests for pcmk__xe_match.
64302d
64302d
---
64302d
 lib/common/tests/xml/Makefile.am           |   3 +-
64302d
 lib/common/tests/xml/pcmk__xe_match_test.c | 105 +++++++++++++++++++++
64302d
 2 files changed, 107 insertions(+), 1 deletion(-)
64302d
 create mode 100644 lib/common/tests/xml/pcmk__xe_match_test.c
64302d
64302d
diff --git a/lib/common/tests/xml/Makefile.am b/lib/common/tests/xml/Makefile.am
64302d
index 342ca07..0ccdcc3 100644
64302d
--- a/lib/common/tests/xml/Makefile.am
64302d
+++ b/lib/common/tests/xml/Makefile.am
64302d
@@ -11,6 +11,7 @@ include $(top_srcdir)/mk/tap.mk
64302d
 include $(top_srcdir)/mk/unittest.mk
64302d
 
64302d
 # Add "_test" to the end of all test program names to simplify .gitignore.
64302d
-check_PROGRAMS =	pcmk__xe_foreach_child_test
64302d
+check_PROGRAMS =	pcmk__xe_foreach_child_test \
64302d
+					pcmk__xe_match_test
64302d
 
64302d
 TESTS = $(check_PROGRAMS)
64302d
diff --git a/lib/common/tests/xml/pcmk__xe_match_test.c b/lib/common/tests/xml/pcmk__xe_match_test.c
64302d
new file mode 100644
64302d
index 0000000..fd529ba
64302d
--- /dev/null
64302d
+++ b/lib/common/tests/xml/pcmk__xe_match_test.c
64302d
@@ -0,0 +1,105 @@
64302d
+/*
64302d
+ * Copyright 2022 the Pacemaker project contributors
64302d
+ *
64302d
+ * The version control history for this file may have further details.
64302d
+ *
64302d
+ * This source code is licensed under the GNU Lesser General Public License
64302d
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
64302d
+ */
64302d
+
64302d
+#include <crm_internal.h>
64302d
+
64302d
+#include <crm/common/unittest_internal.h>
64302d
+#include <crm/common/xml_internal.h>
64302d
+
64302d
+const char *str1 =
64302d
+    "<xml>\n"
64302d
+    "  \n"
64302d
+    "  <nodeA attrA=\"123\" id=\"1\">\n"
64302d
+    "    content\n"
64302d
+    "  </nodeA>\n"
64302d
+    "  \n"
64302d
+    "  <nodeA attrA=\"456\" id=\"2\">\n"
64302d
+    "    content\n"
64302d
+    "  </nodeA>\n"
64302d
+    "  \n"
64302d
+    "  <nodeA attrB=\"XYZ\" id=\"3\">\n"
64302d
+    "    content\n"
64302d
+    "  </nodeA>\n"
64302d
+    "  \n"
64302d
+    "  <nodeB attrA=\"123\" id=\"4\">\n"
64302d
+    "    content\n"
64302d
+    "  </nodeA>\n"
64302d
+    "  \n"
64302d
+    "  <nodeB attrB=\"ABC\" id=\"5\">\n"
64302d
+    "    content\n"
64302d
+    "  </nodeA>\n"
64302d
+    "</xml>";
64302d
+
64302d
+static void
64302d
+bad_input(void **state) {
64302d
+    xmlNode *xml = string2xml(str1);
64302d
+
64302d
+    assert_null(pcmk__xe_match(NULL, NULL, NULL, NULL));
64302d
+    assert_null(pcmk__xe_match(NULL, NULL, NULL, "attrX"));
64302d
+
64302d
+    free_xml(xml);
64302d
+}
64302d
+
64302d
+static void
64302d
+not_found(void **state) {
64302d
+    xmlNode *xml = string2xml(str1);
64302d
+
64302d
+    /* No node with an attrX attribute */
64302d
+    assert_null(pcmk__xe_match(xml, NULL, "attrX", NULL));
64302d
+    /* No nodeX node */
64302d
+    assert_null(pcmk__xe_match(xml, "nodeX", NULL, NULL));
64302d
+    /* No nodeA node with attrX */
64302d
+    assert_null(pcmk__xe_match(xml, "nodeA", "attrX", NULL));
64302d
+    /* No nodeA node with attrA=XYZ */
64302d
+    assert_null(pcmk__xe_match(xml, "nodeA", "attrA", "XYZ"));
64302d
+
64302d
+    free_xml(xml);
64302d
+}
64302d
+
64302d
+static void
64302d
+find_attrB(void **state) {
64302d
+    xmlNode *xml = string2xml(str1);
64302d
+    xmlNode *result = NULL;
64302d
+
64302d
+    /* Find the first node with attrB */
64302d
+    result = pcmk__xe_match(xml, NULL, "attrB", NULL);
64302d
+    assert_non_null(result);
64302d
+    assert_string_equal(crm_element_value(result, "id"), "3");
64302d
+
64302d
+    /* Find the first nodeB with attrB */
64302d
+    result = pcmk__xe_match(xml, "nodeB", "attrB", NULL);
64302d
+    assert_non_null(result);
64302d
+    assert_string_equal(crm_element_value(result, "id"), "5");
64302d
+
64302d
+    free_xml(xml);
64302d
+}
64302d
+
64302d
+static void
64302d
+find_attrA_matching(void **state) {
64302d
+    xmlNode *xml = string2xml(str1);
64302d
+    xmlNode *result = NULL;
64302d
+
64302d
+    /* Find attrA=456 */
64302d
+    result = pcmk__xe_match(xml, NULL, "attrA", "456");
64302d
+    assert_non_null(result);
64302d
+    assert_string_equal(crm_element_value(result, "id"), "2");
64302d
+
64302d
+    /* Find a nodeB with attrA=123 */
64302d
+    result = pcmk__xe_match(xml, "nodeB", "attrA", "123");
64302d
+    assert_non_null(result);
64302d
+    assert_string_equal(crm_element_value(result, "id"), "4");
64302d
+
64302d
+    free_xml(xml);
64302d
+}
64302d
+
64302d
+PCMK__UNIT_TEST(NULL, NULL,
64302d
+                cmocka_unit_test(bad_input),
64302d
+                cmocka_unit_test(not_found),
64302d
+                cmocka_unit_test(find_attrB),
64302d
+                cmocka_unit_test(find_attrA_matching));
64302d
-- 
64302d
2.31.1
64302d
64302d
From 03af8498d8aaf21c509cec9b0ec4b78475da41d7 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 8 Sep 2022 12:22:26 -0400
64302d
Subject: [PATCH 04/26] Feature: libcrmcommon: Add attrd options for specifying
64302d
 a sync point.
64302d
64302d
---
64302d
 include/crm/common/attrd_internal.h | 16 +++++++++-------
64302d
 1 file changed, 9 insertions(+), 7 deletions(-)
64302d
64302d
diff --git a/include/crm/common/attrd_internal.h b/include/crm/common/attrd_internal.h
64302d
index f7033ad..389be48 100644
64302d
--- a/include/crm/common/attrd_internal.h
64302d
+++ b/include/crm/common/attrd_internal.h
64302d
@@ -16,13 +16,15 @@ extern "C" {
64302d
 
64302d
 // Options for clients to use with functions below
64302d
 enum pcmk__node_attr_opts {
64302d
-    pcmk__node_attr_none    = 0,
64302d
-    pcmk__node_attr_remote  = (1 << 0),
64302d
-    pcmk__node_attr_private = (1 << 1),
64302d
-    pcmk__node_attr_pattern = (1 << 2),
64302d
-    pcmk__node_attr_value   = (1 << 3),
64302d
-    pcmk__node_attr_delay   = (1 << 4),
64302d
-    pcmk__node_attr_perm    = (1 << 5),
64302d
+    pcmk__node_attr_none           = 0,
64302d
+    pcmk__node_attr_remote         = (1 << 0),
64302d
+    pcmk__node_attr_private        = (1 << 1),
64302d
+    pcmk__node_attr_pattern        = (1 << 2),
64302d
+    pcmk__node_attr_value          = (1 << 3),
64302d
+    pcmk__node_attr_delay          = (1 << 4),
64302d
+    pcmk__node_attr_perm           = (1 << 5),
64302d
+    pcmk__node_attr_sync_local     = (1 << 6),
64302d
+    pcmk__node_attr_sync_cluster   = (1 << 7),
64302d
 };
64302d
 
64302d
 #define pcmk__set_node_attr_flags(node_attr_flags, flags_to_set) do {   \
64302d
-- 
64302d
2.31.1
64302d
64302d
From 5c8825293ee21d3823bdcd01b0df9c7d39739940 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 8 Sep 2022 12:23:09 -0400
64302d
Subject: [PATCH 05/26] Feature: libcrmcommon: Add sync point to IPC request
64302d
 XML.
64302d
64302d
If one of the pcmk__node_attr_sync_* options is provided, add an
64302d
attribute to the request XML.  This will later be inspected by the
64302d
server to determine when to send the reply to the client.
64302d
---
64302d
 include/crm/common/options_internal.h | 2 ++
64302d
 include/crm_internal.h                | 1 +
64302d
 lib/common/ipc_attrd.c                | 6 ++++++
64302d
 3 files changed, 9 insertions(+)
64302d
64302d
diff --git a/include/crm/common/options_internal.h b/include/crm/common/options_internal.h
64302d
index b153c67..f29ba3f 100644
64302d
--- a/include/crm/common/options_internal.h
64302d
+++ b/include/crm/common/options_internal.h
64302d
@@ -145,9 +145,11 @@ bool pcmk__valid_sbd_timeout(const char *value);
64302d
 #define PCMK__META_ALLOW_UNHEALTHY_NODES    "allow-unhealthy-nodes"
64302d
 
64302d
 // Constants for enumerated values for various options
64302d
+#define PCMK__VALUE_CLUSTER                 "cluster"
64302d
 #define PCMK__VALUE_CUSTOM                  "custom"
64302d
 #define PCMK__VALUE_FENCING                 "fencing"
64302d
 #define PCMK__VALUE_GREEN                   "green"
64302d
+#define PCMK__VALUE_LOCAL                   "local"
64302d
 #define PCMK__VALUE_MIGRATE_ON_RED          "migrate-on-red"
64302d
 #define PCMK__VALUE_NONE                    "none"
64302d
 #define PCMK__VALUE_NOTHING                 "nothing"
64302d
diff --git a/include/crm_internal.h b/include/crm_internal.h
64302d
index e6e2e96..08193c3 100644
64302d
--- a/include/crm_internal.h
64302d
+++ b/include/crm_internal.h
64302d
@@ -71,6 +71,7 @@
64302d
 #define PCMK__XA_ATTR_RESOURCE          "attr_resource"
64302d
 #define PCMK__XA_ATTR_SECTION           "attr_section"
64302d
 #define PCMK__XA_ATTR_SET               "attr_set"
64302d
+#define PCMK__XA_ATTR_SYNC_POINT        "attr_sync_point"
64302d
 #define PCMK__XA_ATTR_USER              "attr_user"
64302d
 #define PCMK__XA_ATTR_UUID              "attr_key"
64302d
 #define PCMK__XA_ATTR_VALUE             "attr_value"
64302d
diff --git a/lib/common/ipc_attrd.c b/lib/common/ipc_attrd.c
64302d
index f6cfbc4..4606509 100644
64302d
--- a/lib/common/ipc_attrd.c
64302d
+++ b/lib/common/ipc_attrd.c
64302d
@@ -431,6 +431,12 @@ populate_update_op(xmlNode *op, const char *node, const char *name, const char *
64302d
                     pcmk_is_set(options, pcmk__node_attr_remote));
64302d
     crm_xml_add_int(op, PCMK__XA_ATTR_IS_PRIVATE,
64302d
                     pcmk_is_set(options, pcmk__node_attr_private));
64302d
+
64302d
+    if (pcmk_is_set(options, pcmk__node_attr_sync_local)) {
64302d
+        crm_xml_add(op, PCMK__XA_ATTR_SYNC_POINT, PCMK__VALUE_LOCAL);
64302d
+    } else if (pcmk_is_set(options, pcmk__node_attr_sync_cluster)) {
64302d
+        crm_xml_add(op, PCMK__XA_ATTR_SYNC_POINT, PCMK__VALUE_CLUSTER);
64302d
+    }
64302d
 }
64302d
 
64302d
 int
64302d
-- 
64302d
2.31.1
64302d
64302d
From e2b3fee630caf0846ca8bbffcef4d6d2acfd32a5 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 8 Sep 2022 12:26:28 -0400
64302d
Subject: [PATCH 06/26] Feature: tools: Add --wait= parameter to attrd_updater.
64302d
64302d
This command line option is used to specify the sync point to use.  For
64302d
the moment, it has no effect.
64302d
---
64302d
 tools/attrd_updater.c | 24 ++++++++++++++++++++++++
64302d
 1 file changed, 24 insertions(+)
64302d
64302d
diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c
64302d
index b85a281..c4779a6 100644
64302d
--- a/tools/attrd_updater.c
64302d
+++ b/tools/attrd_updater.c
64302d
@@ -97,6 +97,22 @@ section_cb (const gchar *option_name, const gchar *optarg, gpointer data, GError
64302d
     return TRUE;
64302d
 }
64302d
 
64302d
+static gboolean
64302d
+wait_cb (const gchar *option_name, const gchar *optarg, gpointer data, GError **err) {
64302d
+    if (pcmk__str_eq(optarg, "no", pcmk__str_none)) {
64302d
+        pcmk__clear_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local | pcmk__node_attr_sync_cluster);
64302d
+        return TRUE;
64302d
+    } else if (pcmk__str_eq(optarg, PCMK__VALUE_LOCAL, pcmk__str_none)) {
64302d
+        pcmk__clear_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local | pcmk__node_attr_sync_cluster);
64302d
+        pcmk__set_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local);
64302d
+        return TRUE;
64302d
+    } else {
64302d
+        g_set_error(err, PCMK__EXITC_ERROR, CRM_EX_USAGE,
64302d
+                    "--wait= must be one of 'no', 'local', 'cluster'");
64302d
+        return FALSE;
64302d
+    }
64302d
+}
64302d
+
64302d
 #define INDENT "                              "
64302d
 
64302d
 static GOptionEntry required_entries[] = {
64302d
@@ -175,6 +191,14 @@ static GOptionEntry addl_entries[] = {
64302d
       "If this creates a new attribute, never write the attribute to CIB",
64302d
       NULL },
64302d
 
64302d
+    { "wait", 'W', 0, G_OPTION_ARG_CALLBACK, wait_cb,
64302d
+      "Wait for some event to occur before returning.  Values are 'no' (wait\n"
64302d
+      INDENT "only for the attribute daemon to acknowledge the request) or\n"
64302d
+      INDENT "'local' (wait until the change has propagated to where a local\n"
64302d
+      INDENT "query will return the request value, or the value set by a\n"
64302d
+      INDENT "later request).  Default is 'no'.",
64302d
+      "UNTIL" },
64302d
+
64302d
     { NULL }
64302d
 };
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From 52d51ab41b2f00e72724ab39835b3db86605a96b Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 20 Oct 2022 14:40:13 -0400
64302d
Subject: [PATCH 07/26] Feature: daemons: Add functions for checking a request
64302d
 for a sync point.
64302d
64302d
---
64302d
 daemons/attrd/Makefile.am       |  1 +
64302d
 daemons/attrd/attrd_sync.c      | 38 +++++++++++++++++++++++++++++++++
64302d
 daemons/attrd/pacemaker-attrd.h |  3 +++
64302d
 3 files changed, 42 insertions(+)
64302d
 create mode 100644 daemons/attrd/attrd_sync.c
64302d
64302d
diff --git a/daemons/attrd/Makefile.am b/daemons/attrd/Makefile.am
64302d
index 1a3d360..6bb81c4 100644
64302d
--- a/daemons/attrd/Makefile.am
64302d
+++ b/daemons/attrd/Makefile.am
64302d
@@ -32,6 +32,7 @@ pacemaker_attrd_SOURCES	= attrd_alerts.c 	\
64302d
 						  attrd_elections.c \
64302d
 						  attrd_ipc.c 		\
64302d
 						  attrd_messages.c 		\
64302d
+						  attrd_sync.c 		\
64302d
 						  attrd_utils.c 	\
64302d
 						  pacemaker-attrd.c
64302d
 
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
new file mode 100644
64302d
index 0000000..92759d2
64302d
--- /dev/null
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -0,0 +1,38 @@
64302d
+/*
64302d
+ * Copyright 2022 the Pacemaker project contributors
64302d
+ *
64302d
+ * The version control history for this file may have further details.
64302d
+ *
64302d
+ * This source code is licensed under the GNU General Public License version 2
64302d
+ * or later (GPLv2+) WITHOUT ANY WARRANTY.
64302d
+ */
64302d
+
64302d
+#include <crm_internal.h>
64302d
+
64302d
+#include <crm/msg_xml.h>
64302d
+#include <crm/common/attrd_internal.h>
64302d
+
64302d
+#include "pacemaker-attrd.h"
64302d
+
64302d
+const char *
64302d
+attrd_request_sync_point(xmlNode *xml)
64302d
+{
64302d
+    if (xml_has_children(xml)) {
64302d
+        xmlNode *child = pcmk__xe_match(xml, XML_ATTR_OP, PCMK__XA_ATTR_SYNC_POINT, NULL);
64302d
+
64302d
+        if (child) {
64302d
+            return crm_element_value(child, PCMK__XA_ATTR_SYNC_POINT);
64302d
+        } else {
64302d
+            return NULL;
64302d
+        }
64302d
+
64302d
+    } else {
64302d
+        return crm_element_value(xml, PCMK__XA_ATTR_SYNC_POINT);
64302d
+    }
64302d
+}
64302d
+
64302d
+bool
64302d
+attrd_request_has_sync_point(xmlNode *xml)
64302d
+{
64302d
+    return attrd_request_sync_point(xml) != NULL;
64302d
+}
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index 71ce90a..ff850bb 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -182,4 +182,7 @@ mainloop_timer_t *attrd_add_timer(const char *id, int timeout_ms, attribute_t *a
64302d
 void attrd_unregister_handlers(void);
64302d
 void attrd_handle_request(pcmk__request_t *request);
64302d
 
64302d
+const char *attrd_request_sync_point(xmlNode *xml);
64302d
+bool attrd_request_has_sync_point(xmlNode *xml);
64302d
+
64302d
 #endif /* PACEMAKER_ATTRD__H */
64302d
-- 
64302d
2.31.1
64302d
64302d
From 2e0509a12ee7d4a612133ee65b75245eea7d271d Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 20 Oct 2022 14:42:04 -0400
64302d
Subject: [PATCH 08/26] Refactor: daemons: Don't ACK update requests that give
64302d
 a sync point.
64302d
64302d
The ACK is the only response from the server for update messages.  If
64302d
the message specified that it wanted to wait for a sync point, we need
64302d
to delay sending that response until the sync point is reached.
64302d
Therefore, do not always immediately send the ACK.
64302d
---
64302d
 daemons/attrd/attrd_messages.c | 19 ++++++++++++++-----
64302d
 1 file changed, 14 insertions(+), 5 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index de4a28a..9e8ae40 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -137,12 +137,21 @@ handle_update_request(pcmk__request_t *request)
64302d
         attrd_peer_update(peer, request->xml, host, false);
64302d
         pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
         return NULL;
64302d
+
64302d
     } else {
64302d
-        /* Because attrd_client_update can be called recursively, we send the ACK
64302d
-         * here to ensure that the client only ever receives one.
64302d
-         */
64302d
-        attrd_send_ack(request->ipc_client, request->ipc_id,
64302d
-                       request->flags|crm_ipc_client_response);
64302d
+        if (!attrd_request_has_sync_point(request->xml)) {
64302d
+            /* If the client doesn't want to wait for a sync point, go ahead and send
64302d
+             * the ACK immediately.  Otherwise, we'll send the ACK when the appropriate
64302d
+             * sync point is reached.
64302d
+             *
64302d
+             * In the normal case, attrd_client_update can be called recursively which
64302d
+             * makes where to send the ACK tricky.  Doing it here ensures the client
64302d
+             * only ever receives one.
64302d
+             */
64302d
+            attrd_send_ack(request->ipc_client, request->ipc_id,
64302d
+                           request->flags|crm_ipc_client_response);
64302d
+        }
64302d
+
64302d
         return attrd_client_update(request);
64302d
     }
64302d
 }
64302d
-- 
64302d
2.31.1
64302d
64302d
From 2a0ff66cdf0085c4c8ab1992ef7e785a4facc8c7 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 20 Oct 2022 14:48:48 -0400
64302d
Subject: [PATCH 09/26] Feature: daemons: Add support for local sync points on
64302d
 updates.
64302d
64302d
In the IPC dispatcher for attrd, add the client to a wait list if its
64302d
request specifies a sync point.  When the attribute's value is changed
64302d
on the local attrd, alert any clients waiting on a local sync point by
64302d
then sending the previously delayed ACK.
64302d
64302d
Sync points for other requests and the global sync point are not yet
64302d
supported.
64302d
64302d
Fixes T35.
64302d
---
64302d
 daemons/attrd/attrd_corosync.c  |  18 +++++
64302d
 daemons/attrd/attrd_messages.c  |  12 ++-
64302d
 daemons/attrd/attrd_sync.c      | 137 ++++++++++++++++++++++++++++++++
64302d
 daemons/attrd/pacemaker-attrd.h |   7 ++
64302d
 4 files changed, 173 insertions(+), 1 deletion(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 539e5bf..4337280 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -568,14 +568,32 @@ void
64302d
 attrd_peer_update(const crm_node_t *peer, xmlNode *xml, const char *host,
64302d
                   bool filter)
64302d
 {
64302d
+    bool handle_sync_point = false;
64302d
+
64302d
     if (xml_has_children(xml)) {
64302d
         for (xmlNode *child = first_named_child(xml, XML_ATTR_OP); child != NULL;
64302d
              child = crm_next_same_xml(child)) {
64302d
             copy_attrs(xml, child);
64302d
             attrd_peer_update_one(peer, child, filter);
64302d
+
64302d
+            if (attrd_request_has_sync_point(child)) {
64302d
+                handle_sync_point = true;
64302d
+            }
64302d
         }
64302d
 
64302d
     } else {
64302d
         attrd_peer_update_one(peer, xml, filter);
64302d
+
64302d
+        if (attrd_request_has_sync_point(xml)) {
64302d
+            handle_sync_point = true;
64302d
+        }
64302d
+    }
64302d
+
64302d
+    /* If the update XML specified that the client wanted to wait for a sync
64302d
+     * point, process that now.
64302d
+     */
64302d
+    if (handle_sync_point) {
64302d
+        crm_debug("Hit local sync point for attribute update");
64302d
+        attrd_ack_waitlist_clients(attrd_sync_point_local, xml);
64302d
     }
64302d
 }
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index 9e8ae40..c96700f 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -139,7 +139,17 @@ handle_update_request(pcmk__request_t *request)
64302d
         return NULL;
64302d
 
64302d
     } else {
64302d
-        if (!attrd_request_has_sync_point(request->xml)) {
64302d
+        if (attrd_request_has_sync_point(request->xml)) {
64302d
+            /* If this client supplied a sync point it wants to wait for, add it to
64302d
+             * the wait list.  Clients on this list will not receive an ACK until
64302d
+             * their sync point is hit which will result in the client stalled there
64302d
+             * until it receives a response.
64302d
+             *
64302d
+             * All other clients will receive the expected response as normal.
64302d
+             */
64302d
+            attrd_add_client_to_waitlist(request);
64302d
+
64302d
+        } else {
64302d
             /* If the client doesn't want to wait for a sync point, go ahead and send
64302d
              * the ACK immediately.  Otherwise, we'll send the ACK when the appropriate
64302d
              * sync point is reached.
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index 92759d2..2981bd0 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -14,6 +14,143 @@
64302d
 
64302d
 #include "pacemaker-attrd.h"
64302d
 
64302d
+/* A hash table storing clients that are waiting on a sync point to be reached.
64302d
+ * The key is waitlist_client - just a plain int.  The obvious key would be
64302d
+ * the IPC client's ID, but this is not guaranteed to be unique.  A single client
64302d
+ * could be waiting on a sync point for multiple attributes at the same time.
64302d
+ *
64302d
+ * It is not expected that this hash table will ever be especially large.
64302d
+ */
64302d
+static GHashTable *waitlist = NULL;
64302d
+static int waitlist_client = 0;
64302d
+
64302d
+struct waitlist_node {
64302d
+    /* What kind of sync point does this node describe? */
64302d
+    enum attrd_sync_point sync_point;
64302d
+
64302d
+    /* Information required to construct and send a reply to the client. */
64302d
+    char *client_id;
64302d
+    uint32_t ipc_id;
64302d
+    uint32_t flags;
64302d
+};
64302d
+
64302d
+static void
64302d
+next_key(void)
64302d
+{
64302d
+    do {
64302d
+        waitlist_client++;
64302d
+        if (waitlist_client < 0) {
64302d
+            waitlist_client = 1;
64302d
+        }
64302d
+    } while (g_hash_table_contains(waitlist, GINT_TO_POINTER(waitlist_client)));
64302d
+}
64302d
+
64302d
+static void
64302d
+free_waitlist_node(gpointer data)
64302d
+{
64302d
+    struct waitlist_node *wl = (struct waitlist_node *) data;
64302d
+
64302d
+    free(wl->client_id);
64302d
+    free(wl);
64302d
+}
64302d
+
64302d
+static const char *
64302d
+sync_point_str(enum attrd_sync_point sync_point)
64302d
+{
64302d
+    if (sync_point == attrd_sync_point_local) {
64302d
+        return PCMK__VALUE_LOCAL;
64302d
+    } else if  (sync_point == attrd_sync_point_cluster) {
64302d
+        return PCMK__VALUE_CLUSTER;
64302d
+    } else {
64302d
+        return "unknown";
64302d
+    }
64302d
+}
64302d
+
64302d
+void
64302d
+attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
+{
64302d
+    const char *sync_point = attrd_request_sync_point(request->xml);
64302d
+    struct waitlist_node *wl = NULL;
64302d
+
64302d
+    if (sync_point == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    if (waitlist == NULL) {
64302d
+        waitlist = pcmk__intkey_table(free_waitlist_node);
64302d
+    }
64302d
+
64302d
+    wl = calloc(sizeof(struct waitlist_node), 1);
64302d
+
64302d
+    CRM_ASSERT(wl != NULL);
64302d
+
64302d
+    wl->client_id = strdup(request->ipc_client->id);
64302d
+
64302d
+    CRM_ASSERT(wl->client_id);
64302d
+
64302d
+    if (pcmk__str_eq(sync_point, PCMK__VALUE_LOCAL, pcmk__str_none)) {
64302d
+        wl->sync_point = attrd_sync_point_local;
64302d
+    } else if (pcmk__str_eq(sync_point, PCMK__VALUE_CLUSTER, pcmk__str_none)) {
64302d
+        wl->sync_point = attrd_sync_point_cluster;
64302d
+    } else {
64302d
+        free_waitlist_node(wl);
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    wl->ipc_id = request->ipc_id;
64302d
+    wl->flags = request->flags;
64302d
+
64302d
+    crm_debug("Added client %s to waitlist for %s sync point",
64302d
+              wl->client_id, sync_point_str(wl->sync_point));
64302d
+
64302d
+    next_key();
64302d
+    pcmk__intkey_table_insert(waitlist, waitlist_client, wl);
64302d
+
64302d
+    /* And then add the key to the request XML so we can uniquely identify
64302d
+     * it when it comes time to issue the ACK.
64302d
+     */
64302d
+    crm_xml_add_int(request->xml, XML_LRM_ATTR_CALLID, waitlist_client);
64302d
+}
64302d
+
64302d
+void
64302d
+attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
+{
64302d
+    int callid;
64302d
+    gpointer value;
64302d
+
64302d
+    if (waitlist == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    if (crm_element_value_int(xml, XML_LRM_ATTR_CALLID, &callid) == -1) {
64302d
+        crm_warn("Could not get callid from request XML");
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    value = pcmk__intkey_table_lookup(waitlist, callid);
64302d
+    if (value != NULL) {
64302d
+        struct waitlist_node *wl = (struct waitlist_node *) value;
64302d
+        pcmk__client_t *client = NULL;
64302d
+
64302d
+        if (wl->sync_point != sync_point) {
64302d
+            return;
64302d
+        }
64302d
+
64302d
+        crm_debug("Alerting client %s for reached %s sync point",
64302d
+                  wl->client_id, sync_point_str(wl->sync_point));
64302d
+
64302d
+        client = pcmk__find_client_by_id(wl->client_id);
64302d
+        if (client == NULL) {
64302d
+            return;
64302d
+        }
64302d
+
64302d
+        attrd_send_ack(client, wl->ipc_id, wl->flags | crm_ipc_client_response);
64302d
+
64302d
+        /* And then remove the client so it doesn't get alerted again. */
64302d
+        pcmk__intkey_table_remove(waitlist, callid);
64302d
+    }
64302d
+}
64302d
+
64302d
 const char *
64302d
 attrd_request_sync_point(xmlNode *xml)
64302d
 {
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index ff850bb..9dd8320 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -182,6 +182,13 @@ mainloop_timer_t *attrd_add_timer(const char *id, int timeout_ms, attribute_t *a
64302d
 void attrd_unregister_handlers(void);
64302d
 void attrd_handle_request(pcmk__request_t *request);
64302d
 
64302d
+enum attrd_sync_point {
64302d
+    attrd_sync_point_local,
64302d
+    attrd_sync_point_cluster,
64302d
+};
64302d
+
64302d
+void attrd_add_client_to_waitlist(pcmk__request_t *request);
64302d
+void attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml);
64302d
 const char *attrd_request_sync_point(xmlNode *xml);
64302d
 bool attrd_request_has_sync_point(xmlNode *xml);
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From 59caaf1682191a91d6062358b770f8b9457ba3eb Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 20 Oct 2022 14:56:58 -0400
64302d
Subject: [PATCH 10/26] Feature: daemons: If a client disconnects, remove it
64302d
 from the waitlist.
64302d
64302d
---
64302d
 daemons/attrd/attrd_ipc.c       |  5 +++++
64302d
 daemons/attrd/attrd_sync.c      | 21 +++++++++++++++++++++
64302d
 daemons/attrd/pacemaker-attrd.h |  1 +
64302d
 3 files changed, 27 insertions(+)
64302d
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index 7e4a1c0..8aa39c2 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -438,8 +438,13 @@ attrd_ipc_closed(qb_ipcs_connection_t *c)
64302d
         crm_trace("Ignoring request to clean up unknown connection %p", c);
64302d
     } else {
64302d
         crm_trace("Cleaning up closed client connection %p", c);
64302d
+
64302d
+        /* Remove the client from the sync point waitlist if it's present. */
64302d
+        attrd_remove_client_from_waitlist(client);
64302d
+
64302d
         pcmk__free_client(client);
64302d
     }
64302d
+
64302d
     return FALSE;
64302d
 }
64302d
 
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index 2981bd0..7293318 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -112,6 +112,27 @@ attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
     crm_xml_add_int(request->xml, XML_LRM_ATTR_CALLID, waitlist_client);
64302d
 }
64302d
 
64302d
+void
64302d
+attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
+{
64302d
+    GHashTableIter iter;
64302d
+    gpointer value;
64302d
+
64302d
+    if (waitlist == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    g_hash_table_iter_init(&iter, waitlist);
64302d
+
64302d
+    while (g_hash_table_iter_next(&iter, NULL, &value)) {
64302d
+        struct waitlist_node *wl = (struct waitlist_node *) value;
64302d
+
64302d
+        if (wl->client_id == client->id) {
64302d
+            g_hash_table_iter_remove(&iter);
64302d
+        }
64302d
+    }
64302d
+}
64302d
+
64302d
 void
64302d
 attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
 {
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index 9dd8320..b6ecb75 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -189,6 +189,7 @@ enum attrd_sync_point {
64302d
 
64302d
 void attrd_add_client_to_waitlist(pcmk__request_t *request);
64302d
 void attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml);
64302d
+void attrd_remove_client_from_waitlist(pcmk__client_t *client);
64302d
 const char *attrd_request_sync_point(xmlNode *xml);
64302d
 bool attrd_request_has_sync_point(xmlNode *xml);
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From b28042e1d64b48c96dbd9da1e9ee3ff481bbf620 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Mon, 10 Oct 2022 11:00:20 -0400
64302d
Subject: [PATCH 11/26] Feature: daemons: Add support for local sync points on
64302d
 clearing failures.
64302d
64302d
attrd_clear_client_failure just calls attrd_client_update underneath, so
64302d
that function will handle all the rest of the sync point functionality
64302d
for us.
64302d
---
64302d
 daemons/attrd/attrd_ipc.c      |  2 --
64302d
 daemons/attrd/attrd_messages.c | 19 +++++++++++++++++++
64302d
 2 files changed, 19 insertions(+), 2 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index 8aa39c2..2e614e8 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -101,8 +101,6 @@ attrd_client_clear_failure(pcmk__request_t *request)
64302d
     xmlNode *xml = request->xml;
64302d
     const char *rsc, *op, *interval_spec;
64302d
 
64302d
-    attrd_send_ack(request->ipc_client, request->ipc_id, request->ipc_flags);
64302d
-
64302d
     if (minimum_protocol_version >= 2) {
64302d
         /* Propagate to all peers (including ourselves).
64302d
          * This ends up at attrd_peer_message().
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index c96700f..3ba14a6 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -42,6 +42,25 @@ handle_clear_failure_request(pcmk__request_t *request)
64302d
         pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
         return NULL;
64302d
     } else {
64302d
+        if (attrd_request_has_sync_point(request->xml)) {
64302d
+            /* If this client supplied a sync point it wants to wait for, add it to
64302d
+             * the wait list.  Clients on this list will not receive an ACK until
64302d
+             * their sync point is hit which will result in the client stalled there
64302d
+             * until it receives a response.
64302d
+             *
64302d
+             * All other clients will receive the expected response as normal.
64302d
+             */
64302d
+            attrd_add_client_to_waitlist(request);
64302d
+
64302d
+        } else {
64302d
+            /* If the client doesn't want to wait for a sync point, go ahead and send
64302d
+             * the ACK immediately.  Otherwise, we'll send the ACK when the appropriate
64302d
+             * sync point is reached.
64302d
+             */
64302d
+            attrd_send_ack(request->ipc_client, request->ipc_id,
64302d
+                           request->ipc_flags);
64302d
+        }
64302d
+
64302d
         return attrd_client_clear_failure(request);
64302d
     }
64302d
 }
64302d
-- 
64302d
2.31.1
64302d
64302d
From 291dc3b91e57f2584bbf88cfbe3a360e0332e814 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Mon, 10 Oct 2022 13:17:24 -0400
64302d
Subject: [PATCH 12/26] Refactor: daemons: Free the waitlist on attrd exit.
64302d
64302d
---
64302d
 daemons/attrd/attrd_sync.c      | 11 +++++++++++
64302d
 daemons/attrd/attrd_utils.c     |  2 ++
64302d
 daemons/attrd/pacemaker-attrd.c |  1 +
64302d
 daemons/attrd/pacemaker-attrd.h |  1 +
64302d
 4 files changed, 15 insertions(+)
64302d
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index 7293318..557e49a 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -112,6 +112,17 @@ attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
     crm_xml_add_int(request->xml, XML_LRM_ATTR_CALLID, waitlist_client);
64302d
 }
64302d
 
64302d
+void
64302d
+attrd_free_waitlist(void)
64302d
+{
64302d
+    if (waitlist == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    g_hash_table_destroy(waitlist);
64302d
+    waitlist = NULL;
64302d
+}
64302d
+
64302d
 void
64302d
 attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
 {
64302d
diff --git a/daemons/attrd/attrd_utils.c b/daemons/attrd/attrd_utils.c
64302d
index 6a19009..00b879b 100644
64302d
--- a/daemons/attrd/attrd_utils.c
64302d
+++ b/daemons/attrd/attrd_utils.c
64302d
@@ -93,6 +93,8 @@ attrd_shutdown(int nsig)
64302d
     mainloop_destroy_signal(SIGUSR2);
64302d
     mainloop_destroy_signal(SIGTRAP);
64302d
 
64302d
+    attrd_free_waitlist();
64302d
+
64302d
     if ((mloop == NULL) || !g_main_loop_is_running(mloop)) {
64302d
         /* If there's no main loop active, just exit. This should be possible
64302d
          * only if we get SIGTERM in brief windows at start-up and shutdown.
64302d
diff --git a/daemons/attrd/pacemaker-attrd.c b/daemons/attrd/pacemaker-attrd.c
64302d
index 2100db4..1336542 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.c
64302d
+++ b/daemons/attrd/pacemaker-attrd.c
64302d
@@ -300,6 +300,7 @@ main(int argc, char **argv)
64302d
         attrd_ipc_fini();
64302d
         attrd_lrmd_disconnect();
64302d
         attrd_cib_disconnect();
64302d
+        attrd_free_waitlist();
64302d
         g_hash_table_destroy(attributes);
64302d
     }
64302d
 
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index b6ecb75..537bf85 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -52,6 +52,7 @@ void attrd_run_mainloop(void);
64302d
 
64302d
 void attrd_set_requesting_shutdown(void);
64302d
 void attrd_clear_requesting_shutdown(void);
64302d
+void attrd_free_waitlist(void);
64302d
 bool attrd_requesting_shutdown(void);
64302d
 bool attrd_shutting_down(void);
64302d
 void attrd_shutdown(int nsig);
64302d
-- 
64302d
2.31.1
64302d
64302d
From 7715ce617c520e14687a82e11ff794c93cd7f64a Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Mon, 10 Oct 2022 13:21:16 -0400
64302d
Subject: [PATCH 13/26] Feature: includes: Bump CRM_FEATURE_SET for local sync
64302d
 points.
64302d
64302d
---
64302d
 include/crm/crm.h | 2 +-
64302d
 1 file changed, 1 insertion(+), 1 deletion(-)
64302d
64302d
diff --git a/include/crm/crm.h b/include/crm/crm.h
64302d
index 5710e4b..7c5c602 100644
64302d
--- a/include/crm/crm.h
64302d
+++ b/include/crm/crm.h
64302d
@@ -66,7 +66,7 @@ extern "C" {
64302d
  * >=3.0.13: Fail counts include operation name and interval
64302d
  * >=3.2.0:  DC supports PCMK_EXEC_INVALID and PCMK_EXEC_NOT_CONNECTED
64302d
  */
64302d
-#  define CRM_FEATURE_SET		"3.16.1"
64302d
+#  define CRM_FEATURE_SET		"3.16.2"
64302d
 
64302d
 /* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
64302d
  * recipient of a CPG message. This imposes an arbitrary limit on cluster node
64302d
-- 
64302d
2.31.1
64302d
64302d
From b9054425a76d03f538cd0b3ae27490b1874eee8a Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Fri, 28 Oct 2022 14:23:49 -0400
64302d
Subject: [PATCH 14/26] Refactor: daemons: Add comments for previously added
64302d
 sync point code.
64302d
64302d
---
64302d
 daemons/attrd/attrd_sync.c | 63 ++++++++++++++++++++++++++++++++++++++
64302d
 1 file changed, 63 insertions(+)
64302d
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index 557e49a..e9690b5 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -66,6 +66,20 @@ sync_point_str(enum attrd_sync_point sync_point)
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Add a client to the attrd waitlist
64302d
+ *
64302d
+ * Typically, a client receives an ACK for its XML IPC request immediately.  However,
64302d
+ * some clients want to wait until their request has been processed and taken effect.
64302d
+ * This is called a sync point.  Any client placed on this waitlist will have its
64302d
+ * ACK message delayed until either its requested sync point is hit, or until it
64302d
+ * times out.
64302d
+ *
64302d
+ * The XML IPC request must specify the type of sync point it wants to wait for.
64302d
+ *
64302d
+ * \param[in,out] request   The request describing the client to place on the waitlist.
64302d
+ */
64302d
 void
64302d
 attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
 {
64302d
@@ -112,6 +126,11 @@ attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
     crm_xml_add_int(request->xml, XML_LRM_ATTR_CALLID, waitlist_client);
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Free all memory associated with the waitlist.  This is most typically
64302d
+ *        used when attrd shuts down.
64302d
+ */
64302d
 void
64302d
 attrd_free_waitlist(void)
64302d
 {
64302d
@@ -123,6 +142,13 @@ attrd_free_waitlist(void)
64302d
     waitlist = NULL;
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Unconditionally remove a client from the waitlist, such as when the client
64302d
+ *        node disconnects from the cluster
64302d
+ *
64302d
+ * \param[in] client    The client to remove
64302d
+ */
64302d
 void
64302d
 attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
 {
64302d
@@ -144,6 +170,18 @@ attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Send an IPC ACK message to all awaiting clients
64302d
+ *
64302d
+ * This function will search the waitlist for all clients that are currently awaiting
64302d
+ * an ACK indicating their attrd operation is complete.  Only those clients with a
64302d
+ * matching sync point type and callid from their original XML IPC request will be
64302d
+ * ACKed.  Once they have received an ACK, they will be removed from the waitlist.
64302d
+ *
64302d
+ * \param[in] sync_point What kind of sync point have we hit?
64302d
+ * \param[in] xml        The original XML IPC request.
64302d
+ */
64302d
 void
64302d
 attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
 {
64302d
@@ -183,6 +221,23 @@ attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Return the sync point attribute for an IPC request
64302d
+ *
64302d
+ * This function will check both the top-level element of \p xml for a sync
64302d
+ * point attribute, as well as all of its \p op children, if any.  The latter
64302d
+ * is useful for newer versions of attrd that can put multiple IPC requests
64302d
+ * into a single message.
64302d
+ *
64302d
+ * \param[in] xml   An XML IPC request
64302d
+ *
64302d
+ * \note It is assumed that if one child element has a sync point attribute,
64302d
+ *       all will have a sync point attribute and they will all be the same
64302d
+ *       sync point.  No other configuration is supported.
64302d
+ *
64302d
+ * \return The sync point attribute of \p xml, or NULL if none.
64302d
+ */
64302d
 const char *
64302d
 attrd_request_sync_point(xmlNode *xml)
64302d
 {
64302d
@@ -200,6 +255,14 @@ attrd_request_sync_point(xmlNode *xml)
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Does an IPC request contain any sync point attribute?
64302d
+ *
64302d
+ * \param[in] xml   An XML IPC request
64302d
+ *
64302d
+ * \return true if there's a sync point attribute, false otherwise
64302d
+ */
64302d
 bool
64302d
 attrd_request_has_sync_point(xmlNode *xml)
64302d
 {
64302d
-- 
64302d
2.31.1
64302d
64302d
From 64219fb7075ee58d29f94f077a3b8f94174bb32a Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Wed, 26 Oct 2022 12:43:05 -0400
64302d
Subject: [PATCH 15/26] Feature: tools: Add --wait=cluster option to
64302d
 attrd_updater.
64302d
64302d
---
64302d
 tools/attrd_updater.c | 10 ++++++++--
64302d
 1 file changed, 8 insertions(+), 2 deletions(-)
64302d
64302d
diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c
64302d
index c4779a6..3cd766d 100644
64302d
--- a/tools/attrd_updater.c
64302d
+++ b/tools/attrd_updater.c
64302d
@@ -106,6 +106,10 @@ wait_cb (const gchar *option_name, const gchar *optarg, gpointer data, GError **
64302d
         pcmk__clear_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local | pcmk__node_attr_sync_cluster);
64302d
         pcmk__set_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local);
64302d
         return TRUE;
64302d
+    } else if (pcmk__str_eq(optarg, PCMK__VALUE_CLUSTER, pcmk__str_none)) {
64302d
+        pcmk__clear_node_attr_flags(options.attr_options, pcmk__node_attr_sync_local | pcmk__node_attr_sync_cluster);
64302d
+        pcmk__set_node_attr_flags(options.attr_options, pcmk__node_attr_sync_cluster);
64302d
+        return TRUE;
64302d
     } else {
64302d
         g_set_error(err, PCMK__EXITC_ERROR, CRM_EX_USAGE,
64302d
                     "--wait= must be one of 'no', 'local', 'cluster'");
64302d
@@ -193,10 +197,12 @@ static GOptionEntry addl_entries[] = {
64302d
 
64302d
     { "wait", 'W', 0, G_OPTION_ARG_CALLBACK, wait_cb,
64302d
       "Wait for some event to occur before returning.  Values are 'no' (wait\n"
64302d
-      INDENT "only for the attribute daemon to acknowledge the request) or\n"
64302d
+      INDENT "only for the attribute daemon to acknowledge the request),\n"
64302d
       INDENT "'local' (wait until the change has propagated to where a local\n"
64302d
       INDENT "query will return the request value, or the value set by a\n"
64302d
-      INDENT "later request).  Default is 'no'.",
64302d
+      INDENT "later request), or 'cluster' (wait until the change has propagated\n"
64302d
+      INDENT "to where a query anywhere on the cluster will return the requested\n"
64302d
+      INDENT "value, or the value set by a later request).  Default is 'no'.",
64302d
       "UNTIL" },
64302d
 
64302d
     { NULL }
64302d
-- 
64302d
2.31.1
64302d
64302d
From 1bc5511fadf6ad670508bd3a2a55129bde16f774 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Fri, 16 Sep 2022 14:55:06 -0400
64302d
Subject: [PATCH 16/26] Refactor: daemons: Add a confirm= attribute to attrd
64302d
 messages.
64302d
64302d
This allows informing the originator of a message that the message has
64302d
been received and processed.  As yet, there is no mechanism for handling
64302d
and returning the confirmation, only for requesting it.
64302d
---
64302d
 daemons/attrd/attrd_corosync.c  |  6 +++---
64302d
 daemons/attrd/attrd_ipc.c       | 26 +++++++++++++++++++++-----
64302d
 daemons/attrd/attrd_messages.c  | 11 +++++++++--
64302d
 daemons/attrd/pacemaker-attrd.h |  7 ++++---
64302d
 include/crm_internal.h          |  1 +
64302d
 5 files changed, 38 insertions(+), 13 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 4337280..e86ca07 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -124,7 +124,7 @@ broadcast_local_value(const attribute_t *a)
64302d
 
64302d
     crm_xml_add(sync, PCMK__XA_TASK, PCMK__ATTRD_CMD_SYNC_RESPONSE);
64302d
     attrd_add_value_xml(sync, a, v, false);
64302d
-    attrd_send_message(NULL, sync);
64302d
+    attrd_send_message(NULL, sync, false);
64302d
     free_xml(sync);
64302d
     return v;
64302d
 }
64302d
@@ -387,7 +387,7 @@ broadcast_unseen_local_values(void)
64302d
 
64302d
     if (sync != NULL) {
64302d
         crm_debug("Broadcasting local-only values");
64302d
-        attrd_send_message(NULL, sync);
64302d
+        attrd_send_message(NULL, sync, false);
64302d
         free_xml(sync);
64302d
     }
64302d
 }
64302d
@@ -539,7 +539,7 @@ attrd_peer_sync(crm_node_t *peer, xmlNode *xml)
64302d
     }
64302d
 
64302d
     crm_debug("Syncing values to %s", peer?peer->uname:"everyone");
64302d
-    attrd_send_message(peer, sync);
64302d
+    attrd_send_message(peer, sync, false);
64302d
     free_xml(sync);
64302d
 }
64302d
 
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index 2e614e8..0fc5e93 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -105,7 +105,7 @@ attrd_client_clear_failure(pcmk__request_t *request)
64302d
         /* Propagate to all peers (including ourselves).
64302d
          * This ends up at attrd_peer_message().
64302d
          */
64302d
-        attrd_send_message(NULL, xml);
64302d
+        attrd_send_message(NULL, xml, false);
64302d
         pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
         return NULL;
64302d
     }
64302d
@@ -184,7 +184,7 @@ attrd_client_peer_remove(pcmk__request_t *request)
64302d
     if (host) {
64302d
         crm_info("Client %s is requesting all values for %s be removed",
64302d
                  pcmk__client_name(request->ipc_client), host);
64302d
-        attrd_send_message(NULL, xml); /* ends up at attrd_peer_message() */
64302d
+        attrd_send_message(NULL, xml, false); /* ends up at attrd_peer_message() */
64302d
         free(host_alloc);
64302d
     } else {
64302d
         crm_info("Ignoring request by client %s to remove all peer values without specifying peer",
64302d
@@ -314,7 +314,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
                 }
64302d
             }
64302d
 
64302d
-            attrd_send_message(NULL, xml);
64302d
+            attrd_send_message(NULL, xml, false);
64302d
             pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
 
64302d
         } else {
64302d
@@ -358,7 +358,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
                 if (status == 0) {
64302d
                     crm_trace("Matched %s with %s", attr, regex);
64302d
                     crm_xml_add(xml, PCMK__XA_ATTR_NAME, attr);
64302d
-                    attrd_send_message(NULL, xml);
64302d
+                    attrd_send_message(NULL, xml, false);
64302d
                 }
64302d
             }
64302d
 
64302d
@@ -388,7 +388,23 @@ attrd_client_update(pcmk__request_t *request)
64302d
     crm_debug("Broadcasting %s[%s]=%s%s", attr, crm_element_value(xml, PCMK__XA_ATTR_NODE_NAME),
64302d
               value, (attrd_election_won()? " (writer)" : ""));
64302d
 
64302d
-    attrd_send_message(NULL, xml); /* ends up at attrd_peer_message() */
64302d
+    if (pcmk__str_eq(attrd_request_sync_point(xml), PCMK__VALUE_CLUSTER, pcmk__str_none)) {
64302d
+        /* The client is waiting on the cluster-wide sync point.  In this case,
64302d
+         * the response ACK is not sent until this attrd broadcasts the update
64302d
+         * and receives its own confirmation back from all peers.
64302d
+         */
64302d
+        attrd_send_message(NULL, xml, true); /* ends up at attrd_peer_message() */
64302d
+
64302d
+    } else {
64302d
+        /* The client is either waiting on the local sync point or was not
64302d
+         * waiting on any sync point at all.  For the local sync point, the
64302d
+         * response ACK is sent in attrd_peer_update.  For clients not
64302d
+         * waiting on any sync point, the response ACK is sent in
64302d
+         * handle_update_request immediately before this function was called.
64302d
+         */
64302d
+        attrd_send_message(NULL, xml, false); /* ends up at attrd_peer_message() */
64302d
+    }
64302d
+
64302d
     pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
     return NULL;
64302d
 }
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index 3ba14a6..78df0d0 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -279,16 +279,23 @@ attrd_broadcast_protocol(void)
64302d
     crm_debug("Broadcasting attrd protocol version %s for node %s",
64302d
               ATTRD_PROTOCOL_VERSION, attrd_cluster->uname);
64302d
 
64302d
-    attrd_send_message(NULL, attrd_op); /* ends up at attrd_peer_message() */
64302d
+    attrd_send_message(NULL, attrd_op, false); /* ends up at attrd_peer_message() */
64302d
 
64302d
     free_xml(attrd_op);
64302d
 }
64302d
 
64302d
 gboolean
64302d
-attrd_send_message(crm_node_t * node, xmlNode * data)
64302d
+attrd_send_message(crm_node_t *node, xmlNode *data, bool confirm)
64302d
 {
64302d
     crm_xml_add(data, F_TYPE, T_ATTRD);
64302d
     crm_xml_add(data, PCMK__XA_ATTR_VERSION, ATTRD_PROTOCOL_VERSION);
64302d
+
64302d
+    /* Request a confirmation from the destination peer node (which could
64302d
+     * be all if node is NULL) that the message has been received and
64302d
+     * acted upon.
64302d
+     */
64302d
+    pcmk__xe_set_bool_attr(data, PCMK__XA_CONFIRM, confirm);
64302d
+
64302d
     attrd_xml_add_writer(data);
64302d
     return send_cluster_message(node, crm_msg_attrd, data, TRUE);
64302d
 }
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index 537bf85..25f7c8a 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -39,10 +39,11 @@
64302d
  *                      PCMK__ATTRD_CMD_UPDATE_DELAY
64302d
  *     2       1.1.17   PCMK__ATTRD_CMD_CLEAR_FAILURE
64302d
  *     3       2.1.1    PCMK__ATTRD_CMD_SYNC_RESPONSE indicates remote nodes
64302d
- *     4       2.2.0    Multiple attributes can be updated in a single IPC
64302d
+ *     4       2.1.5    Multiple attributes can be updated in a single IPC
64302d
  *                      message
64302d
+ *     5       2.1.5    Peers can request confirmation of a sent message
64302d
  */
64302d
-#define ATTRD_PROTOCOL_VERSION "4"
64302d
+#define ATTRD_PROTOCOL_VERSION "5"
64302d
 
64302d
 #define attrd_send_ack(client, id, flags) \
64302d
     pcmk__ipc_send_ack((client), (id), (flags), "ack", ATTRD_PROTOCOL_VERSION, CRM_EX_INDETERMINATE)
64302d
@@ -162,7 +163,7 @@ xmlNode *attrd_client_clear_failure(pcmk__request_t *request);
64302d
 xmlNode *attrd_client_update(pcmk__request_t *request);
64302d
 xmlNode *attrd_client_refresh(pcmk__request_t *request);
64302d
 xmlNode *attrd_client_query(pcmk__request_t *request);
64302d
-gboolean attrd_send_message(crm_node_t * node, xmlNode * data);
64302d
+gboolean attrd_send_message(crm_node_t *node, xmlNode *data, bool confirm);
64302d
 
64302d
 xmlNode *attrd_add_value_xml(xmlNode *parent, const attribute_t *a,
64302d
                              const attribute_value_t *v, bool force_write);
64302d
diff --git a/include/crm_internal.h b/include/crm_internal.h
64302d
index 08193c3..63a1726 100644
64302d
--- a/include/crm_internal.h
64302d
+++ b/include/crm_internal.h
64302d
@@ -79,6 +79,7 @@
64302d
 #define PCMK__XA_ATTR_WRITER            "attr_writer"
64302d
 #define PCMK__XA_CONFIG_ERRORS          "config-errors"
64302d
 #define PCMK__XA_CONFIG_WARNINGS        "config-warnings"
64302d
+#define PCMK__XA_CONFIRM                "confirm"
64302d
 #define PCMK__XA_GRAPH_ERRORS           "graph-errors"
64302d
 #define PCMK__XA_GRAPH_WARNINGS         "graph-warnings"
64302d
 #define PCMK__XA_MODE                   "mode"
64302d
-- 
64302d
2.31.1
64302d
64302d
From 6f389038fc0b11f6291c022c99f188666c65f530 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Wed, 26 Oct 2022 14:44:42 -0400
64302d
Subject: [PATCH 17/26] Feature: daemons: Respond to received attrd
64302d
 confirmation requests.
64302d
64302d
On the receiving peer side, if the XML request contains confirm="true",
64302d
construct a confirmation message after handling the request completes
64302d
and send it back to the originating peer.
64302d
64302d
On the originating peer side, add a skeleton handler for confirmation
64302d
messages.  This does nothing at the moment except log it.
64302d
---
64302d
 daemons/attrd/attrd_corosync.c | 38 ++++++++++++++++++++++++++++++++++
64302d
 daemons/attrd/attrd_messages.c | 13 ++++++++++++
64302d
 include/crm_internal.h         |  1 +
64302d
 3 files changed, 52 insertions(+)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index e86ca07..1245d9c 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -25,6 +25,19 @@
64302d
 
64302d
 extern crm_exit_t attrd_exit_status;
64302d
 
64302d
+static xmlNode *
64302d
+attrd_confirmation(int callid)
64302d
+{
64302d
+    xmlNode *node = create_xml_node(NULL, __func__);
64302d
+
64302d
+    crm_xml_add(node, F_TYPE, T_ATTRD);
64302d
+    crm_xml_add(node, F_ORIG, get_local_node_name());
64302d
+    crm_xml_add(node, PCMK__XA_TASK, PCMK__ATTRD_CMD_CONFIRM);
64302d
+    crm_xml_add_int(node, XML_LRM_ATTR_CALLID, callid);
64302d
+
64302d
+    return node;
64302d
+}
64302d
+
64302d
 static void
64302d
 attrd_peer_message(crm_node_t *peer, xmlNode *xml)
64302d
 {
64302d
@@ -57,6 +70,31 @@ attrd_peer_message(crm_node_t *peer, xmlNode *xml)
64302d
         CRM_CHECK(request.op != NULL, return);
64302d
 
64302d
         attrd_handle_request(&request);
64302d
+
64302d
+        /* Having finished handling the request, check to see if the originating
64302d
+         * peer requested confirmation.  If so, send that confirmation back now.
64302d
+         */
64302d
+        if (pcmk__xe_attr_is_true(xml, PCMK__XA_CONFIRM)) {
64302d
+            int callid = 0;
64302d
+            xmlNode *reply = NULL;
64302d
+
64302d
+            /* Add the confirmation ID for the message we are confirming to the
64302d
+             * response so the originating peer knows what they're a confirmation
64302d
+             * for.
64302d
+             */
64302d
+            crm_element_value_int(xml, XML_LRM_ATTR_CALLID, &callid);
64302d
+            reply = attrd_confirmation(callid);
64302d
+
64302d
+            /* And then send the confirmation back to the originating peer.  This
64302d
+             * ends up right back in this same function (attrd_peer_message) on the
64302d
+             * peer where it will have to do something with a PCMK__XA_CONFIRM type
64302d
+             * message.
64302d
+             */
64302d
+            crm_debug("Sending %s a confirmation", peer->uname);
64302d
+            attrd_send_message(peer, reply, false);
64302d
+            free_xml(reply);
64302d
+        }
64302d
+
64302d
         pcmk__reset_request(&request);
64302d
     }
64302d
 }
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index 78df0d0..9c792b2 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -65,6 +65,18 @@ handle_clear_failure_request(pcmk__request_t *request)
64302d
     }
64302d
 }
64302d
 
64302d
+static xmlNode *
64302d
+handle_confirm_request(pcmk__request_t *request)
64302d
+{
64302d
+    if (request->peer != NULL) {
64302d
+        crm_debug("Received confirmation from %s", request->peer);
64302d
+        pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
+        return NULL;
64302d
+    } else {
64302d
+        return handle_unknown_request(request);
64302d
+    }
64302d
+}
64302d
+
64302d
 static xmlNode *
64302d
 handle_flush_request(pcmk__request_t *request)
64302d
 {
64302d
@@ -190,6 +202,7 @@ attrd_register_handlers(void)
64302d
 {
64302d
     pcmk__server_command_t handlers[] = {
64302d
         { PCMK__ATTRD_CMD_CLEAR_FAILURE, handle_clear_failure_request },
64302d
+        { PCMK__ATTRD_CMD_CONFIRM, handle_confirm_request },
64302d
         { PCMK__ATTRD_CMD_FLUSH, handle_flush_request },
64302d
         { PCMK__ATTRD_CMD_PEER_REMOVE, handle_remove_request },
64302d
         { PCMK__ATTRD_CMD_QUERY, handle_query_request },
64302d
diff --git a/include/crm_internal.h b/include/crm_internal.h
64302d
index 63a1726..f60e7b4 100644
64302d
--- a/include/crm_internal.h
64302d
+++ b/include/crm_internal.h
64302d
@@ -108,6 +108,7 @@
64302d
 #define PCMK__ATTRD_CMD_SYNC            "sync"
64302d
 #define PCMK__ATTRD_CMD_SYNC_RESPONSE   "sync-response"
64302d
 #define PCMK__ATTRD_CMD_CLEAR_FAILURE   "clear-failure"
64302d
+#define PCMK__ATTRD_CMD_CONFIRM         "confirm"
64302d
 
64302d
 #define PCMK__CONTROLD_CMD_NODES        "list-nodes"
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From dfb730e9ced9dc75886fda9452c584860573fe30 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Wed, 26 Oct 2022 15:58:00 -0400
64302d
Subject: [PATCH 18/26] Feature: daemons: Keep track of #attrd-protocol from
64302d
 each peer.
64302d
64302d
This information can be used in the future when dealing with
64302d
cluster-wide sync points to know which peers we are waiting on a reply
64302d
from.
64302d
---
64302d
 daemons/attrd/attrd_corosync.c  |  3 +-
64302d
 daemons/attrd/attrd_utils.c     | 60 ++++++++++++++++++++++++++++++---
64302d
 daemons/attrd/pacemaker-attrd.h |  4 ++-
64302d
 3 files changed, 60 insertions(+), 7 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 1245d9c..6f88ab6 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -268,6 +268,7 @@ attrd_peer_change_cb(enum crm_status_type kind, crm_node_t *peer, const void *da
64302d
     // Remove votes from cluster nodes that leave, in case election in progress
64302d
     if (gone && !is_remote) {
64302d
         attrd_remove_voter(peer);
64302d
+        attrd_remove_peer_protocol_ver(peer->uname);
64302d
 
64302d
     // Ensure remote nodes that come up are in the remote node cache
64302d
     } else if (!gone && is_remote) {
64302d
@@ -395,7 +396,7 @@ attrd_peer_update_one(const crm_node_t *peer, xmlNode *xml, bool filter)
64302d
      * version, check to see if it's a new minimum version.
64302d
      */
64302d
     if (pcmk__str_eq(attr, CRM_ATTR_PROTOCOL, pcmk__str_none)) {
64302d
-        attrd_update_minimum_protocol_ver(value);
64302d
+        attrd_update_minimum_protocol_ver(peer->uname, value);
64302d
     }
64302d
 }
64302d
 
64302d
diff --git a/daemons/attrd/attrd_utils.c b/daemons/attrd/attrd_utils.c
64302d
index 00b879b..421faed 100644
64302d
--- a/daemons/attrd/attrd_utils.c
64302d
+++ b/daemons/attrd/attrd_utils.c
64302d
@@ -29,6 +29,11 @@ static bool requesting_shutdown = false;
64302d
 static bool shutting_down = false;
64302d
 static GMainLoop *mloop = NULL;
64302d
 
64302d
+/* A hash table storing information on the protocol version of each peer attrd.
64302d
+ * The key is the peer's uname, and the value is the protocol version number.
64302d
+ */
64302d
+GHashTable *peer_protocol_vers = NULL;
64302d
+
64302d
 /*!
64302d
  * \internal
64302d
  * \brief  Set requesting_shutdown state
64302d
@@ -94,6 +99,10 @@ attrd_shutdown(int nsig)
64302d
     mainloop_destroy_signal(SIGTRAP);
64302d
 
64302d
     attrd_free_waitlist();
64302d
+    if (peer_protocol_vers != NULL) {
64302d
+        g_hash_table_destroy(peer_protocol_vers);
64302d
+        peer_protocol_vers = NULL;
64302d
+    }
64302d
 
64302d
     if ((mloop == NULL) || !g_main_loop_is_running(mloop)) {
64302d
         /* If there's no main loop active, just exit. This should be possible
64302d
@@ -273,16 +282,57 @@ attrd_free_attribute(gpointer data)
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief When a peer node leaves the cluster, stop tracking its protocol version.
64302d
+ *
64302d
+ * \param[in] host  The peer node's uname to be removed
64302d
+ */
64302d
+void
64302d
+attrd_remove_peer_protocol_ver(const char *host)
64302d
+{
64302d
+    if (peer_protocol_vers != NULL) {
64302d
+        g_hash_table_remove(peer_protocol_vers, host);
64302d
+    }
64302d
+}
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief When a peer node broadcasts a message with its protocol version, keep
64302d
+ *        track of that information.
64302d
+ *
64302d
+ * We keep track of each peer's protocol version so we know which peers to
64302d
+ * expect confirmation messages from when handling cluster-wide sync points.
64302d
+ * We additionally keep track of the lowest protocol version supported by all
64302d
+ * peers so we know when we can send IPC messages containing more than one
64302d
+ * request.
64302d
+ *
64302d
+ * \param[in] host  The peer node's uname to be tracked
64302d
+ * \param[in] value The peer node's protocol version
64302d
+ */
64302d
 void
64302d
-attrd_update_minimum_protocol_ver(const char *value)
64302d
+attrd_update_minimum_protocol_ver(const char *host, const char *value)
64302d
 {
64302d
     int ver;
64302d
 
64302d
+    if (peer_protocol_vers == NULL) {
64302d
+        peer_protocol_vers = pcmk__strkey_table(free, NULL);
64302d
+    }
64302d
+
64302d
     pcmk__scan_min_int(value, &ver, 0);
64302d
 
64302d
-    if (ver > 0 && (minimum_protocol_version == -1 || ver < minimum_protocol_version)) {
64302d
-        minimum_protocol_version = ver;
64302d
-        crm_trace("Set minimum attrd protocol version to %d",
64302d
-                  minimum_protocol_version);
64302d
+    if (ver > 0) {
64302d
+        char *host_name = strdup(host);
64302d
+
64302d
+        /* Record the peer attrd's protocol version. */
64302d
+        CRM_ASSERT(host_name != NULL);
64302d
+        g_hash_table_insert(peer_protocol_vers, host_name, GINT_TO_POINTER(ver));
64302d
+
64302d
+        /* If the protocol version is a new minimum, record it as such. */
64302d
+        if (minimum_protocol_version == -1 || ver < minimum_protocol_version) {
64302d
+            minimum_protocol_version = ver;
64302d
+            crm_trace("Set minimum attrd protocol version to %d",
64302d
+                      minimum_protocol_version);
64302d
+        }
64302d
     }
64302d
 }
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index 25f7c8a..302ef63 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -145,6 +145,7 @@ typedef struct attribute_value_s {
64302d
 
64302d
 extern crm_cluster_t *attrd_cluster;
64302d
 extern GHashTable *attributes;
64302d
+extern GHashTable *peer_protocol_vers;
64302d
 
64302d
 #define CIB_OP_TIMEOUT_S 120
64302d
 
64302d
@@ -177,7 +178,8 @@ void attrd_write_attributes(bool all, bool ignore_delay);
64302d
 void attrd_write_or_elect_attribute(attribute_t *a);
64302d
 
64302d
 extern int minimum_protocol_version;
64302d
-void attrd_update_minimum_protocol_ver(const char *value);
64302d
+void attrd_remove_peer_protocol_ver(const char *host);
64302d
+void attrd_update_minimum_protocol_ver(const char *host, const char *value);
64302d
 
64302d
 mainloop_timer_t *attrd_add_timer(const char *id, int timeout_ms, attribute_t *attr);
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From 945f0fe51d3bf69c2cb1258b394f2f11b8996525 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 27 Oct 2022 14:42:59 -0400
64302d
Subject: [PATCH 19/26] Feature: daemons: Handle cluster-wide sync points in
64302d
 attrd.
64302d
64302d
When an attrd receives an IPC request to update some value, record the
64302d
protocol versions of all peer attrds.  Additionally register a function
64302d
that will be called when all confirmations are received.
64302d
64302d
The originating IPC cilent (attrd_updater for instance) will sit there
64302d
waiting for an ACK until its timeout is hit.
64302d
64302d
As each confirmation message comes back to attrd, mark it off the list
64302d
of peers we are waiting on.  When no more peers are expected, call the
64302d
previously registered function.
64302d
64302d
For attribute updates, this function just sends an ack back to
64302d
attrd_updater.
64302d
64302d
Fixes T35
64302d
---
64302d
 daemons/attrd/attrd_corosync.c  |   1 +
64302d
 daemons/attrd/attrd_ipc.c       |   4 +
64302d
 daemons/attrd/attrd_messages.c  |  10 ++
64302d
 daemons/attrd/attrd_sync.c      | 260 +++++++++++++++++++++++++++++++-
64302d
 daemons/attrd/attrd_utils.c     |   2 +
64302d
 daemons/attrd/pacemaker-attrd.h |   8 +
64302d
 6 files changed, 281 insertions(+), 4 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 6f88ab6..37701aa 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -269,6 +269,7 @@ attrd_peer_change_cb(enum crm_status_type kind, crm_node_t *peer, const void *da
64302d
     if (gone && !is_remote) {
64302d
         attrd_remove_voter(peer);
64302d
         attrd_remove_peer_protocol_ver(peer->uname);
64302d
+        attrd_do_not_expect_from_peer(peer->uname);
64302d
 
64302d
     // Ensure remote nodes that come up are in the remote node cache
64302d
     } else if (!gone && is_remote) {
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index 0fc5e93..c70aa1b 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -393,6 +393,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
          * the response ACK is not sent until this attrd broadcasts the update
64302d
          * and receives its own confirmation back from all peers.
64302d
          */
64302d
+        attrd_expect_confirmations(request, attrd_cluster_sync_point_update);
64302d
         attrd_send_message(NULL, xml, true); /* ends up at attrd_peer_message() */
64302d
 
64302d
     } else {
64302d
@@ -456,6 +457,9 @@ attrd_ipc_closed(qb_ipcs_connection_t *c)
64302d
         /* Remove the client from the sync point waitlist if it's present. */
64302d
         attrd_remove_client_from_waitlist(client);
64302d
 
64302d
+        /* And no longer wait for confirmations from any peers. */
64302d
+        attrd_do_not_wait_for_client(client);
64302d
+
64302d
         pcmk__free_client(client);
64302d
     }
64302d
 
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index 9c792b2..f7b9c7c 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -69,7 +69,17 @@ static xmlNode *
64302d
 handle_confirm_request(pcmk__request_t *request)
64302d
 {
64302d
     if (request->peer != NULL) {
64302d
+        int callid;
64302d
+
64302d
         crm_debug("Received confirmation from %s", request->peer);
64302d
+
64302d
+        if (crm_element_value_int(request->xml, XML_LRM_ATTR_CALLID, &callid) == -1) {
64302d
+            pcmk__set_result(&request->result, CRM_EX_PROTOCOL, PCMK_EXEC_INVALID,
64302d
+                             "Could not get callid from XML");
64302d
+        } else {
64302d
+            attrd_handle_confirmation(callid, request->peer);
64302d
+        }
64302d
+
64302d
         pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
         return NULL;
64302d
     } else {
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index e9690b5..d3d7108 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -34,6 +34,51 @@ struct waitlist_node {
64302d
     uint32_t flags;
64302d
 };
64302d
 
64302d
+/* A hash table storing information on in-progress IPC requests that are awaiting
64302d
+ * confirmations.  These requests are currently being processed by peer attrds and
64302d
+ * we are waiting to receive confirmation messages from each peer indicating that
64302d
+ * processing is complete.
64302d
+ *
64302d
+ * Multiple requests could be waiting on confirmations at the same time.
64302d
+ *
64302d
+ * The key is the unique callid for the IPC request, and the value is a
64302d
+ * confirmation_action struct.
64302d
+ */
64302d
+static GHashTable *expected_confirmations = NULL;
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief A structure describing a single IPC request that is awaiting confirmations
64302d
+ */
64302d
+struct confirmation_action {
64302d
+    /*!
64302d
+     * \brief A list of peer attrds that we are waiting to receive confirmation
64302d
+     *        messages from
64302d
+     *
64302d
+     * This list is dynamic - as confirmations arrive from peer attrds, they will
64302d
+     * be removed from this list.  When the list is empty, all peers have processed
64302d
+     * the request and the associated confirmation action will be taken.
64302d
+     */
64302d
+    GList *respondents;
64302d
+
64302d
+    /*!
64302d
+     * \brief A function to run when all confirmations have been received
64302d
+     */
64302d
+    attrd_confirmation_action_fn fn;
64302d
+
64302d
+    /*!
64302d
+     * \brief Information required to construct and send a reply to the client
64302d
+     */
64302d
+    char *client_id;
64302d
+    uint32_t ipc_id;
64302d
+    uint32_t flags;
64302d
+
64302d
+    /*!
64302d
+     * \brief The XML request containing the callid associated with this action
64302d
+     */
64302d
+    void *xml;
64302d
+};
64302d
+
64302d
 static void
64302d
 next_key(void)
64302d
 {
64302d
@@ -114,12 +159,13 @@ attrd_add_client_to_waitlist(pcmk__request_t *request)
64302d
     wl->ipc_id = request->ipc_id;
64302d
     wl->flags = request->flags;
64302d
 
64302d
-    crm_debug("Added client %s to waitlist for %s sync point",
64302d
-              wl->client_id, sync_point_str(wl->sync_point));
64302d
-
64302d
     next_key();
64302d
     pcmk__intkey_table_insert(waitlist, waitlist_client, wl);
64302d
 
64302d
+    crm_trace("Added client %s to waitlist for %s sync point",
64302d
+              wl->client_id, sync_point_str(wl->sync_point));
64302d
+    crm_trace("%d clients now on waitlist", g_hash_table_size(waitlist));
64302d
+
64302d
     /* And then add the key to the request XML so we can uniquely identify
64302d
      * it when it comes time to issue the ACK.
64302d
      */
64302d
@@ -166,6 +212,7 @@ attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
 
64302d
         if (wl->client_id == client->id) {
64302d
             g_hash_table_iter_remove(&iter);
64302d
+            crm_trace("%d clients now on waitlist", g_hash_table_size(waitlist));
64302d
         }
64302d
     }
64302d
 }
64302d
@@ -206,7 +253,7 @@ attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
             return;
64302d
         }
64302d
 
64302d
-        crm_debug("Alerting client %s for reached %s sync point",
64302d
+        crm_trace("Alerting client %s for reached %s sync point",
64302d
                   wl->client_id, sync_point_str(wl->sync_point));
64302d
 
64302d
         client = pcmk__find_client_by_id(wl->client_id);
64302d
@@ -218,9 +265,28 @@ attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
64302d
 
64302d
         /* And then remove the client so it doesn't get alerted again. */
64302d
         pcmk__intkey_table_remove(waitlist, callid);
64302d
+
64302d
+        crm_trace("%d clients now on waitlist", g_hash_table_size(waitlist));
64302d
     }
64302d
 }
64302d
 
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Action to take when a cluster sync point is hit for a
64302d
+ *        PCMK__ATTRD_CMD_UPDATE* message.
64302d
+ *
64302d
+ * \param[in] xml  The request that should be passed along to
64302d
+ *                 attrd_ack_waitlist_clients.  This should be the original
64302d
+ *                 IPC request containing the callid for this update message.
64302d
+ */
64302d
+int
64302d
+attrd_cluster_sync_point_update(xmlNode *xml)
64302d
+{
64302d
+    crm_trace("Hit cluster sync point for attribute update");
64302d
+    attrd_ack_waitlist_clients(attrd_sync_point_cluster, xml);
64302d
+    return pcmk_rc_ok;
64302d
+}
64302d
+
64302d
 /*!
64302d
  * \internal
64302d
  * \brief Return the sync point attribute for an IPC request
64302d
@@ -268,3 +334,189 @@ attrd_request_has_sync_point(xmlNode *xml)
64302d
 {
64302d
     return attrd_request_sync_point(xml) != NULL;
64302d
 }
64302d
+
64302d
+static void
64302d
+free_action(gpointer data)
64302d
+{
64302d
+    struct confirmation_action *action = (struct confirmation_action *) data;
64302d
+    g_list_free_full(action->respondents, free);
64302d
+    free_xml(action->xml);
64302d
+    free(action->client_id);
64302d
+    free(action);
64302d
+}
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief When a peer disconnects from the cluster, no longer wait for its confirmation
64302d
+ *        for any IPC action.  If this peer is the last one being waited on, this will
64302d
+ *        trigger the confirmation action.
64302d
+ *
64302d
+ * \param[in] host   The disconnecting peer attrd's uname
64302d
+ */
64302d
+void
64302d
+attrd_do_not_expect_from_peer(const char *host)
64302d
+{
64302d
+    GList *keys = g_hash_table_get_keys(expected_confirmations);
64302d
+
64302d
+    crm_trace("Removing peer %s from expected confirmations", host);
64302d
+
64302d
+    for (GList *node = keys; node != NULL; node = node->next) {
64302d
+        int callid = *(int *) node->data;
64302d
+        attrd_handle_confirmation(callid, host);
64302d
+    }
64302d
+
64302d
+    g_list_free(keys);
64302d
+}
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief When a client disconnects from the cluster, no longer wait on confirmations
64302d
+ *        for it.  Because the peer attrds may still be processing the original IPC
64302d
+ *        message, they may still send us confirmations.  However, we will take no
64302d
+ *        action on them.
64302d
+ *
64302d
+ * \param[in] client    The disconnecting client
64302d
+ */
64302d
+void
64302d
+attrd_do_not_wait_for_client(pcmk__client_t *client)
64302d
+{
64302d
+    GHashTableIter iter;
64302d
+    gpointer value;
64302d
+
64302d
+    if (expected_confirmations == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    g_hash_table_iter_init(&iter, expected_confirmations);
64302d
+
64302d
+    while (g_hash_table_iter_next(&iter, NULL, &value)) {
64302d
+        struct confirmation_action *action = (struct confirmation_action *) value;
64302d
+
64302d
+        if (pcmk__str_eq(action->client_id, client->id, pcmk__str_none)) {
64302d
+            crm_trace("Removing client %s from expected confirmations", client->id);
64302d
+            g_hash_table_iter_remove(&iter);
64302d
+            crm_trace("%d requests now in expected confirmations table", g_hash_table_size(expected_confirmations));
64302d
+            break;
64302d
+        }
64302d
+    }
64302d
+}
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Register some action to be taken when IPC request confirmations are
64302d
+ *        received
64302d
+ *
64302d
+ * When this function is called, a list of all peer attrds that support confirming
64302d
+ * requests is generated.  As confirmations from these peer attrds are received,
64302d
+ * they are removed from this list.  When the list is empty, the registered action
64302d
+ * will be called.
64302d
+ *
64302d
+ * \note This function should always be called before attrd_send_message is called
64302d
+ *       to broadcast to the peers to ensure that we know what replies we are
64302d
+ *       waiting on.  Otherwise, it is possible the peer could finish and confirm
64302d
+ *       before we know to expect it.
64302d
+ *
64302d
+ * \param[in] request The request that is awaiting confirmations
64302d
+ * \param[in] fn      A function to be run after all confirmations are received
64302d
+ */
64302d
+void
64302d
+attrd_expect_confirmations(pcmk__request_t *request, attrd_confirmation_action_fn fn)
64302d
+{
64302d
+    struct confirmation_action *action = NULL;
64302d
+    GHashTableIter iter;
64302d
+    gpointer host, ver;
64302d
+    GList *respondents = NULL;
64302d
+    int callid;
64302d
+
64302d
+    if (expected_confirmations == NULL) {
64302d
+        expected_confirmations = pcmk__intkey_table((GDestroyNotify) free_action);
64302d
+    }
64302d
+
64302d
+    if (crm_element_value_int(request->xml, XML_LRM_ATTR_CALLID, &callid) == -1) {
64302d
+        crm_err("Could not get callid from xml");
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    if (pcmk__intkey_table_lookup(expected_confirmations, callid)) {
64302d
+        crm_err("Already waiting on confirmations for call id %d", callid);
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    g_hash_table_iter_init(&iter, peer_protocol_vers);
64302d
+    while (g_hash_table_iter_next(&iter, &host, &ver)) {
64302d
+        if (GPOINTER_TO_INT(ver) >= 5) {
64302d
+            char *s = strdup((char *) host);
64302d
+
64302d
+            CRM_ASSERT(s != NULL);
64302d
+            respondents = g_list_prepend(respondents, s);
64302d
+        }
64302d
+    }
64302d
+
64302d
+    action = calloc(1, sizeof(struct confirmation_action));
64302d
+    CRM_ASSERT(action != NULL);
64302d
+
64302d
+    action->respondents = respondents;
64302d
+    action->fn = fn;
64302d
+    action->xml = copy_xml(request->xml);
64302d
+
64302d
+    action->client_id = strdup(request->ipc_client->id);
64302d
+    CRM_ASSERT(action->client_id != NULL);
64302d
+
64302d
+    action->ipc_id = request->ipc_id;
64302d
+    action->flags = request->flags;
64302d
+
64302d
+    pcmk__intkey_table_insert(expected_confirmations, callid, action);
64302d
+    crm_trace("Callid %d now waiting on %d confirmations", callid, g_list_length(respondents));
64302d
+    crm_trace("%d requests now in expected confirmations table", g_hash_table_size(expected_confirmations));
64302d
+}
64302d
+
64302d
+void
64302d
+attrd_free_confirmations(void)
64302d
+{
64302d
+    if (expected_confirmations != NULL) {
64302d
+        g_hash_table_destroy(expected_confirmations);
64302d
+        expected_confirmations = NULL;
64302d
+    }
64302d
+}
64302d
+
64302d
+/*!
64302d
+ * \internal
64302d
+ * \brief Process a confirmation message from a peer attrd
64302d
+ *
64302d
+ * This function is called every time a PCMK__ATTRD_CMD_CONFIRM message is
64302d
+ * received from a peer attrd.  If this is the last confirmation we are waiting
64302d
+ * on for a given operation, the registered action will be called.
64302d
+ *
64302d
+ * \param[in] callid The unique callid for the XML IPC request
64302d
+ * \param[in] host   The confirming peer attrd's uname
64302d
+ */
64302d
+void
64302d
+attrd_handle_confirmation(int callid, const char *host)
64302d
+{
64302d
+    struct confirmation_action *action = NULL;
64302d
+    GList *node = NULL;
64302d
+
64302d
+    if (expected_confirmations == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    action = pcmk__intkey_table_lookup(expected_confirmations, callid);
64302d
+    if (action == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    node = g_list_find_custom(action->respondents, host, (GCompareFunc) strcasecmp);
64302d
+
64302d
+    if (node == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    action->respondents = g_list_remove(action->respondents, node->data);
64302d
+    crm_trace("Callid %d now waiting on %d confirmations", callid, g_list_length(action->respondents));
64302d
+
64302d
+    if (action->respondents == NULL) {
64302d
+        action->fn(action->xml);
64302d
+        pcmk__intkey_table_remove(expected_confirmations, callid);
64302d
+        crm_trace("%d requests now in expected confirmations table", g_hash_table_size(expected_confirmations));
64302d
+    }
64302d
+}
64302d
diff --git a/daemons/attrd/attrd_utils.c b/daemons/attrd/attrd_utils.c
64302d
index 421faed..f3a2059 100644
64302d
--- a/daemons/attrd/attrd_utils.c
64302d
+++ b/daemons/attrd/attrd_utils.c
64302d
@@ -99,6 +99,8 @@ attrd_shutdown(int nsig)
64302d
     mainloop_destroy_signal(SIGTRAP);
64302d
 
64302d
     attrd_free_waitlist();
64302d
+    attrd_free_confirmations();
64302d
+
64302d
     if (peer_protocol_vers != NULL) {
64302d
         g_hash_table_destroy(peer_protocol_vers);
64302d
         peer_protocol_vers = NULL;
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index 302ef63..bcc329d 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -191,8 +191,16 @@ enum attrd_sync_point {
64302d
     attrd_sync_point_cluster,
64302d
 };
64302d
 
64302d
+typedef int (*attrd_confirmation_action_fn)(xmlNode *);
64302d
+
64302d
 void attrd_add_client_to_waitlist(pcmk__request_t *request);
64302d
 void attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml);
64302d
+int attrd_cluster_sync_point_update(xmlNode *xml);
64302d
+void attrd_do_not_expect_from_peer(const char *host);
64302d
+void attrd_do_not_wait_for_client(pcmk__client_t *client);
64302d
+void attrd_expect_confirmations(pcmk__request_t *request, attrd_confirmation_action_fn fn);
64302d
+void attrd_free_confirmations(void);
64302d
+void attrd_handle_confirmation(int callid, const char *host);
64302d
 void attrd_remove_client_from_waitlist(pcmk__client_t *client);
64302d
 const char *attrd_request_sync_point(xmlNode *xml);
64302d
 bool attrd_request_has_sync_point(xmlNode *xml);
64302d
-- 
64302d
2.31.1
64302d
64302d
From 07a032a7eb2f03dce18a7c94c56b8c837dedda15 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Fri, 28 Oct 2022 14:54:15 -0400
64302d
Subject: [PATCH 20/26] Refactor: daemons: Add some attrd version checking
64302d
 macros.
64302d
64302d
These are just to make it a little more obvious what is actually being
64302d
asked in the code, instead of having magic numbers sprinkled around.
64302d
---
64302d
 daemons/attrd/attrd_ipc.c       | 2 +-
64302d
 daemons/attrd/attrd_sync.c      | 2 +-
64302d
 daemons/attrd/pacemaker-attrd.h | 3 +++
64302d
 3 files changed, 5 insertions(+), 2 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index c70aa1b..16bfff4 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -294,7 +294,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
      * two ways we can handle that.
64302d
      */
64302d
     if (xml_has_children(xml)) {
64302d
-        if (minimum_protocol_version >= 4) {
64302d
+        if (ATTRD_SUPPORTS_MULTI_MESSAGE(minimum_protocol_version)) {
64302d
             /* First, if all peers support a certain protocol version, we can
64302d
              * just broadcast the big message and they'll handle it.  However,
64302d
              * we also need to apply all the transformations in this function
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index d3d7108..e48f82e 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -444,7 +444,7 @@ attrd_expect_confirmations(pcmk__request_t *request, attrd_confirmation_action_f
64302d
 
64302d
     g_hash_table_iter_init(&iter, peer_protocol_vers);
64302d
     while (g_hash_table_iter_next(&iter, &host, &ver)) {
64302d
-        if (GPOINTER_TO_INT(ver) >= 5) {
64302d
+        if (ATTRD_SUPPORTS_CONFIRMATION(GPOINTER_TO_INT(ver))) {
64302d
             char *s = strdup((char *) host);
64302d
 
64302d
             CRM_ASSERT(s != NULL);
64302d
diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h
64302d
index bcc329d..83d7c6b 100644
64302d
--- a/daemons/attrd/pacemaker-attrd.h
64302d
+++ b/daemons/attrd/pacemaker-attrd.h
64302d
@@ -45,6 +45,9 @@
64302d
  */
64302d
 #define ATTRD_PROTOCOL_VERSION "5"
64302d
 
64302d
+#define ATTRD_SUPPORTS_MULTI_MESSAGE(x) ((x) >= 4)
64302d
+#define ATTRD_SUPPORTS_CONFIRMATION(x)  ((x) >= 5)
64302d
+
64302d
 #define attrd_send_ack(client, id, flags) \
64302d
     pcmk__ipc_send_ack((client), (id), (flags), "ack", ATTRD_PROTOCOL_VERSION, CRM_EX_INDETERMINATE)
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From 811361b96c6f26a1f5eccc54b6e8bf6e6fd003be Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Mon, 31 Oct 2022 12:53:22 -0400
64302d
Subject: [PATCH 21/26] Low: attrd: Fix removing clients from the waitlist when
64302d
 they disconnect.
64302d
64302d
The client ID is a string, so it must be compared like a string.
64302d
---
64302d
 daemons/attrd/attrd_sync.c | 2 +-
64302d
 1 file changed, 1 insertion(+), 1 deletion(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index e48f82e..c9b4784 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -210,7 +210,7 @@ attrd_remove_client_from_waitlist(pcmk__client_t *client)
64302d
     while (g_hash_table_iter_next(&iter, NULL, &value)) {
64302d
         struct waitlist_node *wl = (struct waitlist_node *) value;
64302d
 
64302d
-        if (wl->client_id == client->id) {
64302d
+        if (pcmk__str_eq(wl->client_id, client->id, pcmk__str_none)) {
64302d
             g_hash_table_iter_remove(&iter);
64302d
             crm_trace("%d clients now on waitlist", g_hash_table_size(waitlist));
64302d
         }
64302d
-- 
64302d
2.31.1
64302d
64302d
From 4e933ad14456af85c60701410c3b23b4eab03f86 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Tue, 1 Nov 2022 12:35:12 -0400
64302d
Subject: [PATCH 22/26] Feature: daemons: Handle an attrd client timing out.
64302d
64302d
If the update confirmations do not come back in time, use a main loop
64302d
timer to remove the client from the table.
64302d
---
64302d
 daemons/attrd/attrd_sync.c | 49 ++++++++++++++++++++++++++++++++++++++
64302d
 1 file changed, 49 insertions(+)
64302d
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index c9b4784..9d07796 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -61,6 +61,12 @@ struct confirmation_action {
64302d
      */
64302d
     GList *respondents;
64302d
 
64302d
+    /*!
64302d
+     * \brief A timer that will be used to remove the client should it time out
64302d
+     *        before receiving all confirmations
64302d
+     */
64302d
+    mainloop_timer_t *timer;
64302d
+
64302d
     /*!
64302d
      * \brief A function to run when all confirmations have been received
64302d
      */
64302d
@@ -340,11 +346,51 @@ free_action(gpointer data)
64302d
 {
64302d
     struct confirmation_action *action = (struct confirmation_action *) data;
64302d
     g_list_free_full(action->respondents, free);
64302d
+    mainloop_timer_del(action->timer);
64302d
     free_xml(action->xml);
64302d
     free(action->client_id);
64302d
     free(action);
64302d
 }
64302d
 
64302d
+/* Remove an IPC request from the expected_confirmations table if the peer attrds
64302d
+ * don't respond before the timeout is hit.  We set the timeout to 15s.  The exact
64302d
+ * number isn't critical - we just want to make sure that the table eventually gets
64302d
+ * cleared of things that didn't complete.
64302d
+ */
64302d
+static gboolean
64302d
+confirmation_timeout_cb(gpointer data)
64302d
+{
64302d
+    struct confirmation_action *action = (struct confirmation_action *) data;
64302d
+
64302d
+    GHashTableIter iter;
64302d
+    gpointer value;
64302d
+
64302d
+    if (expected_confirmations == NULL) {
64302d
+        return G_SOURCE_REMOVE;
64302d
+    }
64302d
+
64302d
+    g_hash_table_iter_init(&iter, expected_confirmations);
64302d
+
64302d
+    while (g_hash_table_iter_next(&iter, NULL, &value)) {
64302d
+        if (value == action) {
64302d
+            pcmk__client_t *client = pcmk__find_client_by_id(action->client_id);
64302d
+            if (client == NULL) {
64302d
+                return G_SOURCE_REMOVE;
64302d
+            }
64302d
+
64302d
+            crm_trace("Timed out waiting for confirmations for client %s", client->id);
64302d
+            pcmk__ipc_send_ack(client, action->ipc_id, action->flags | crm_ipc_client_response,
64302d
+                               "ack", ATTRD_PROTOCOL_VERSION, CRM_EX_TIMEOUT);
64302d
+
64302d
+            g_hash_table_iter_remove(&iter);
64302d
+            crm_trace("%d requests now in expected confirmations table", g_hash_table_size(expected_confirmations));
64302d
+            break;
64302d
+        }
64302d
+    }
64302d
+
64302d
+    return G_SOURCE_REMOVE;
64302d
+}
64302d
+
64302d
 /*!
64302d
  * \internal
64302d
  * \brief When a peer disconnects from the cluster, no longer wait for its confirmation
64302d
@@ -465,6 +511,9 @@ attrd_expect_confirmations(pcmk__request_t *request, attrd_confirmation_action_f
64302d
     action->ipc_id = request->ipc_id;
64302d
     action->flags = request->flags;
64302d
 
64302d
+    action->timer = mainloop_timer_add(NULL, 15000, FALSE, confirmation_timeout_cb, action);
64302d
+    mainloop_timer_start(action->timer);
64302d
+
64302d
     pcmk__intkey_table_insert(expected_confirmations, callid, action);
64302d
     crm_trace("Callid %d now waiting on %d confirmations", callid, g_list_length(respondents));
64302d
     crm_trace("%d requests now in expected confirmations table", g_hash_table_size(expected_confirmations));
64302d
-- 
64302d
2.31.1
64302d
64302d
From 101896383cbe0103c98078e46540c076af08f040 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Wed, 2 Nov 2022 14:40:30 -0400
64302d
Subject: [PATCH 23/26] Refactor: Demote a sync point related message to trace.
64302d
64302d
---
64302d
 daemons/attrd/attrd_corosync.c | 2 +-
64302d
 1 file changed, 1 insertion(+), 1 deletion(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 37701aa..5cbed7e 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -633,7 +633,7 @@ attrd_peer_update(const crm_node_t *peer, xmlNode *xml, const char *host,
64302d
      * point, process that now.
64302d
      */
64302d
     if (handle_sync_point) {
64302d
-        crm_debug("Hit local sync point for attribute update");
64302d
+        crm_trace("Hit local sync point for attribute update");
64302d
         attrd_ack_waitlist_clients(attrd_sync_point_local, xml);
64302d
     }
64302d
 }
64302d
-- 
64302d
2.31.1
64302d
64302d
From acd13246d4c2bef7982ca103e34896efcad22348 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Thu, 3 Nov 2022 10:29:20 -0400
64302d
Subject: [PATCH 24/26] Low: daemons: Avoid infinite confirm loops in attrd.
64302d
64302d
On the sending side, do not add confirm="yes" to a message with
64302d
op="confirm".  On the receiving side, do not confirm a message with
64302d
op="confirm" even if confirm="yes" is set.
64302d
---
64302d
 daemons/attrd/attrd_corosync.c | 3 ++-
64302d
 daemons/attrd/attrd_messages.c | 6 +++++-
64302d
 2 files changed, 7 insertions(+), 2 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c
64302d
index 5cbed7e..88c1ecc 100644
64302d
--- a/daemons/attrd/attrd_corosync.c
64302d
+++ b/daemons/attrd/attrd_corosync.c
64302d
@@ -74,7 +74,8 @@ attrd_peer_message(crm_node_t *peer, xmlNode *xml)
64302d
         /* Having finished handling the request, check to see if the originating
64302d
          * peer requested confirmation.  If so, send that confirmation back now.
64302d
          */
64302d
-        if (pcmk__xe_attr_is_true(xml, PCMK__XA_CONFIRM)) {
64302d
+        if (pcmk__xe_attr_is_true(xml, PCMK__XA_CONFIRM) &&
64302d
+            !pcmk__str_eq(request.op, PCMK__ATTRD_CMD_CONFIRM, pcmk__str_none)) {
64302d
             int callid = 0;
64302d
             xmlNode *reply = NULL;
64302d
 
64302d
diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c
64302d
index f7b9c7c..184176a 100644
64302d
--- a/daemons/attrd/attrd_messages.c
64302d
+++ b/daemons/attrd/attrd_messages.c
64302d
@@ -310,6 +310,8 @@ attrd_broadcast_protocol(void)
64302d
 gboolean
64302d
 attrd_send_message(crm_node_t *node, xmlNode *data, bool confirm)
64302d
 {
64302d
+    const char *op = crm_element_value(data, PCMK__XA_TASK);
64302d
+
64302d
     crm_xml_add(data, F_TYPE, T_ATTRD);
64302d
     crm_xml_add(data, PCMK__XA_ATTR_VERSION, ATTRD_PROTOCOL_VERSION);
64302d
 
64302d
@@ -317,7 +319,9 @@ attrd_send_message(crm_node_t *node, xmlNode *data, bool confirm)
64302d
      * be all if node is NULL) that the message has been received and
64302d
      * acted upon.
64302d
      */
64302d
-    pcmk__xe_set_bool_attr(data, PCMK__XA_CONFIRM, confirm);
64302d
+    if (!pcmk__str_eq(op, PCMK__ATTRD_CMD_CONFIRM, pcmk__str_none)) {
64302d
+        pcmk__xe_set_bool_attr(data, PCMK__XA_CONFIRM, confirm);
64302d
+    }
64302d
 
64302d
     attrd_xml_add_writer(data);
64302d
     return send_cluster_message(node, crm_msg_attrd, data, TRUE);
64302d
-- 
64302d
2.31.1
64302d
64302d
From 115e6c3a0d8db4df3eccf6da1c344168799f890d Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Tue, 15 Nov 2022 09:35:28 -0500
64302d
Subject: [PATCH 25/26] Fix: daemons: Check for NULL in
64302d
 attrd_do_not_expect_from_peer.
64302d
64302d
---
64302d
 daemons/attrd/attrd_sync.c | 8 +++++++-
64302d
 1 file changed, 7 insertions(+), 1 deletion(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c
64302d
index 9d07796..6936771 100644
64302d
--- a/daemons/attrd/attrd_sync.c
64302d
+++ b/daemons/attrd/attrd_sync.c
64302d
@@ -402,7 +402,13 @@ confirmation_timeout_cb(gpointer data)
64302d
 void
64302d
 attrd_do_not_expect_from_peer(const char *host)
64302d
 {
64302d
-    GList *keys = g_hash_table_get_keys(expected_confirmations);
64302d
+    GList *keys = NULL;
64302d
+
64302d
+    if (expected_confirmations == NULL) {
64302d
+        return;
64302d
+    }
64302d
+
64302d
+    keys = g_hash_table_get_keys(expected_confirmations);
64302d
 
64302d
     crm_trace("Removing peer %s from expected confirmations", host);
64302d
 
64302d
-- 
64302d
2.31.1
64302d
64302d
From 05da14f97ccd4f63f53801acc107ad661e5fd0c8 Mon Sep 17 00:00:00 2001
64302d
From: Chris Lumens <clumens@redhat.com>
64302d
Date: Wed, 16 Nov 2022 17:37:44 -0500
64302d
Subject: [PATCH 26/26] Low: daemons: Support cluster-wide sync points for
64302d
 multi IPC messages.
64302d
64302d
Supporting cluster-wide sync points means attrd_expect_confirmations
64302d
needs to be called, and then attrd_send_message needs "true" as a third
64302d
argument.  This indicates attrd wants confirmations back from all its
64302d
peers when they have applied the update.
64302d
64302d
We're already doing this at the end of attrd_client_update for
64302d
single-update IPC messages, and handling it for multi-update messages is
64302d
a simple matter of breaking that code out into a function and making
64302d
sure it's called.
64302d
64302d
Note that this leaves two other spots where sync points still need to be
64302d
dealt with:
64302d
64302d
* An update message that uses a regex.  See
64302d
  https://projects.clusterlabs.org/T600 for details.
64302d
64302d
* A multi-update IPC message in a cluster where that is not supported.
64302d
  See https://projects.clusterlabs.org/T601 for details.
64302d
---
64302d
 daemons/attrd/attrd_ipc.c | 43 ++++++++++++++++++++++-----------------
64302d
 1 file changed, 24 insertions(+), 19 deletions(-)
64302d
64302d
diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c
64302d
index 16bfff4..8c5660d 100644
64302d
--- a/daemons/attrd/attrd_ipc.c
64302d
+++ b/daemons/attrd/attrd_ipc.c
64302d
@@ -283,6 +283,28 @@ handle_value_expansion(const char **value, xmlNode *xml, const char *op,
64302d
     return pcmk_rc_ok;
64302d
 }
64302d
 
64302d
+static void
64302d
+send_update_msg_to_cluster(pcmk__request_t *request, xmlNode *xml)
64302d
+{
64302d
+    if (pcmk__str_eq(attrd_request_sync_point(xml), PCMK__VALUE_CLUSTER, pcmk__str_none)) {
64302d
+        /* The client is waiting on the cluster-wide sync point.  In this case,
64302d
+         * the response ACK is not sent until this attrd broadcasts the update
64302d
+         * and receives its own confirmation back from all peers.
64302d
+         */
64302d
+        attrd_expect_confirmations(request, attrd_cluster_sync_point_update);
64302d
+        attrd_send_message(NULL, xml, true); /* ends up at attrd_peer_message() */
64302d
+
64302d
+    } else {
64302d
+        /* The client is either waiting on the local sync point or was not
64302d
+         * waiting on any sync point at all.  For the local sync point, the
64302d
+         * response ACK is sent in attrd_peer_update.  For clients not
64302d
+         * waiting on any sync point, the response ACK is sent in
64302d
+         * handle_update_request immediately before this function was called.
64302d
+         */
64302d
+        attrd_send_message(NULL, xml, false); /* ends up at attrd_peer_message() */
64302d
+    }
64302d
+}
64302d
+
64302d
 xmlNode *
64302d
 attrd_client_update(pcmk__request_t *request)
64302d
 {
64302d
@@ -314,7 +336,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
                 }
64302d
             }
64302d
 
64302d
-            attrd_send_message(NULL, xml, false);
64302d
+            send_update_msg_to_cluster(request, xml);
64302d
             pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
 
64302d
         } else {
64302d
@@ -388,24 +410,7 @@ attrd_client_update(pcmk__request_t *request)
64302d
     crm_debug("Broadcasting %s[%s]=%s%s", attr, crm_element_value(xml, PCMK__XA_ATTR_NODE_NAME),
64302d
               value, (attrd_election_won()? " (writer)" : ""));
64302d
 
64302d
-    if (pcmk__str_eq(attrd_request_sync_point(xml), PCMK__VALUE_CLUSTER, pcmk__str_none)) {
64302d
-        /* The client is waiting on the cluster-wide sync point.  In this case,
64302d
-         * the response ACK is not sent until this attrd broadcasts the update
64302d
-         * and receives its own confirmation back from all peers.
64302d
-         */
64302d
-        attrd_expect_confirmations(request, attrd_cluster_sync_point_update);
64302d
-        attrd_send_message(NULL, xml, true); /* ends up at attrd_peer_message() */
64302d
-
64302d
-    } else {
64302d
-        /* The client is either waiting on the local sync point or was not
64302d
-         * waiting on any sync point at all.  For the local sync point, the
64302d
-         * response ACK is sent in attrd_peer_update.  For clients not
64302d
-         * waiting on any sync point, the response ACK is sent in
64302d
-         * handle_update_request immediately before this function was called.
64302d
-         */
64302d
-        attrd_send_message(NULL, xml, false); /* ends up at attrd_peer_message() */
64302d
-    }
64302d
-
64302d
+    send_update_msg_to_cluster(request, xml);
64302d
     pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
64302d
     return NULL;
64302d
 }
64302d
-- 
64302d
2.31.1
64302d