File pacemaker-crmd-match-only-executed-down-events.patch of Package pacemaker.14737

commit bc36e16c02b5e08fcda2a5a582416d7ce5cfb3d5
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Thu Feb 22 10:27:36 2018 -0600

    Fix: crmd: match only executed down events
    
    Before, if a downed node had more than one event that could make it down (e.g.
    a remote node with a fence and a connection stop), the crmd could match an
    action that hadn't yet been initiated, and thus abort the transition
    unnecessarily.

diff --git a/crmd/te_callbacks.c b/crmd/te_callbacks.c
index 258c9b290..2aa643387 100644
--- a/crmd/te_callbacks.c
+++ b/crmd/te_callbacks.c
@@ -350,7 +350,7 @@ abort_unless_down(const char *xpath, const char *op, xmlNode *change,
     }
 
     down = match_down_event(node_uuid, TRUE);
-    if(down == NULL || down->executed == false) {
+    if (down == NULL) {
         crm_trace("Not expecting %s to be down (%s)", node_uuid, xpath);
         abort_transition(INFINITY, tg_restart, reason, change);
     } else {
diff --git a/crmd/te_events.c b/crmd/te_events.c
index 7f470db47..019ec63b3 100644
--- a/crmd/te_events.c
+++ b/crmd/te_events.c
@@ -414,11 +414,16 @@ match_down_event(const char *target, bool quiet)
              gIter2 = gIter2->next) {
 
             match = (crm_action_t*)gIter2->data;
-            xpath_ret = xpath_search(match->xml, xpath);
-            if (numXpathResults(xpath_ret) < 1) {
+            if (match->executed) {
+                xpath_ret = xpath_search(match->xml, xpath);
+                if (numXpathResults(xpath_ret) < 1) {
+                    match = NULL;
+                }
+                freeXpathObject(xpath_ret);
+            } else {
+                // Only actions that were actually started can match
                 match = NULL;
             }
-            freeXpathObject(xpath_ret);
         }
     }
 
openSUSE Build Service is sponsored by