File pacemaker-crmd-dont-abort-for-v2-diff-LRM-refresh-if-actions-pending.patch of Package pacemaker.14737

commit 0fd0b906383bd6a7bd7c748b69fe746faa02af39
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Tue Feb 27 12:37:10 2018 -0600

    Low: crmd: don't abort for v2 diff LRM refresh if actions pending
    
    Already the case for v1 diffs, and should apply to v2 as well.

diff --git a/crmd/te_callbacks.c b/crmd/te_callbacks.c
index 976e57e62..258c9b290 100644
--- a/crmd/te_callbacks.c
+++ b/crmd/te_callbacks.c
@@ -248,9 +248,7 @@ static void
 process_resource_updates(const char *node, xmlNode *xml, xmlNode *change,
                          const char *op, const char *xpath)
 {
-    xmlNode *cIter = NULL;
     xmlNode *rsc = NULL;
-    int num_resources = 0;
 
     if (xml == NULL) {
         return;
@@ -262,24 +260,21 @@ process_resource_updates(const char *node, xmlNode *xml, xmlNode *change,
 
     CRM_ASSERT(strcmp((const char*)xml->name, XML_LRM_TAG_RESOURCES) == 0);
 
-    for (cIter = xml->children; cIter; cIter = cIter->next) {
-        num_resources++;
-    }
-
-    if (num_resources > 1) {
-        /*
-         * Updates by, or in response to, TE actions will never contain updates
-         * for more than one resource at a time, so such updates indicate an
-         * LRM refresh.
-         *
-         * In that case, start a new transition rather than check each result
-         * individually, which can result in _huge_ speedups in large clusters.
-         *
-         * Unfortunately, we can only do so when there are no pending actions.
-         * Otherwise, we could mistakenly throw away those results here, and
-         * the cluster will stall waiting for them and time out the operation.
-         */
-        crm_debug("Detected LRM refresh - %d resources updated", num_resources);
+    /*
+     * Updates by, or in response to, TE actions will never contain updates
+     * for more than one resource at a time, so such updates indicate an
+     * LRM refresh.
+     *
+     * In that case, start a new transition rather than check each result
+     * individually, which can result in _huge_ speedups in large clusters.
+     *
+     * Unfortunately, we can only do so when there are no pending actions.
+     * Otherwise, we could mistakenly throw away those results here, and
+     * the cluster will stall waiting for them and time out the operation.
+     */
+    if ((transition_graph->pending == 0)
+        && xml->children && xml->children->next) {
+
         crm_log_xml_trace(change, "lrm-refresh");
         abort_transition(INFINITY, tg_restart, "LRM Refresh", NULL);
         return;
openSUSE Build Service is sponsored by