Blob Blame History Raw
From 6aa3f536559372c618ca80d116e2b4d563a0b9b9 Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Sat, 10 Sep 2022 03:39:12 -0700
Subject: [PATCH] Fix: controller: Resource reordering doesn't cause transition
 abort

The te_update_diff_v2() function ignores all move operations. This is
correct for most CIB sections. However, a move in the resources section
affects placement order and can require resources to change nodes. In
that case, since the diff handler does not cause a transition abort, the
moves will not be initiated until the next natural transition (up to the
value of cluster-recheck-interval).

This commit modifies te_update_diff_v2() so that it no longer ignores
moves within the resources section.

This fixes a regression triggered by 41d0a1a and set up by 45e5e82.
However, the underlying bug had already been present. Prior to 41d0a1a,
the CIB replacement notification handler caused a transition abort, when
the resources section was replaced, which hid this bug.

Closes T549

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
 daemons/controld/controld_te_callbacks.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/daemons/controld/controld_te_callbacks.c b/daemons/controld/controld_te_callbacks.c
index 7ed75fa..c922f58 100644
--- a/daemons/controld/controld_te_callbacks.c
+++ b/daemons/controld/controld_te_callbacks.c
@@ -412,7 +412,13 @@ te_update_diff_v2(xmlNode *diff)
             crm_trace("Ignoring %s change for version field", op);
             continue;
 
-        } else if (strcmp(op, "move") == 0) {
+        } else if ((strcmp(op, "move") == 0)
+                   && (strstr(xpath,
+                              "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION
+                              "/" XML_CIB_TAG_RESOURCES) == NULL)) {
+            /* We still need to consider moves within the resources section,
+             * since they affect placement order.
+             */
             crm_trace("Ignoring move change at %s", xpath);
             continue;
         }
@@ -427,7 +433,7 @@ te_update_diff_v2(xmlNode *diff)
                 match = match->children;
             }
 
-        } else if (strcmp(op, "delete") != 0) {
+        } else if (!pcmk__str_any_of(op, "delete", "move", NULL)) {
             crm_warn("Ignoring malformed CIB update (%s operation on %s is unrecognized)",
                      op, xpath);
             continue;
-- 
2.31.1