File pacemaker-libpe_status-precedence-of-operation-meta-attributes.patch of Package pacemaker

commit 023897afcd4895c9be35add3fe67614ec0dd4e2b
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Tue Dec 5 18:26:23 2017 -0600

    Fix: libpe_status: fix precedence of operation meta-attributes
    
    Operations were unpacked such that op_defaults were the base, then any XML
    properties of the <op> tag itself took precedence over that, and then any
    meta_attributes and instance_attributes beneath the <op> tag had the lowest
    precedence.
    
    This changes it so that the <op> tag has the highest precedence,
    then <op> <meta_attributes>, then <op_defaults> <meta_attributes>,
    then <op> <instance_attributes> (which is deprecated for setting
    meta-attributes).

diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
index 0ce0e30c9..bbf9e72a7 100644
--- a/lib/pengine/utils.c
+++ b/lib/pengine/utils.c
@@ -925,9 +925,21 @@ unpack_operation(action_t * action, xmlNode * xml_obj, resource_t * container,
 
     CRM_CHECK(action->rsc != NULL, return);
 
+    // Cluster-wide <op_defaults> <meta_attributes>
     unpack_instance_attributes(data_set->input, data_set->op_defaults, XML_TAG_META_SETS, NULL,
                                action->meta, NULL, FALSE, data_set->now);
 
+    // <op> <meta_attributes> take precedence over defaults
+    unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_META_SETS,
+                               NULL, action->meta, NULL, TRUE, data_set->now);
+
+    // <op> <instance_attributes> have lowest precedence (deprecated)
+    unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_ATTR_SETS,
+                               NULL, action->meta, NULL, FALSE, data_set->now);
+
+    /* Anything set as an <op> XML property has highest precedence.
+     * This ensures we use the name and interval from the <op> tag.
+     */
     if (xml_obj) {
         xmlAttrPtr xIter = NULL;
 
@@ -939,12 +951,6 @@ unpack_operation(action_t * action, xmlNode * xml_obj, resource_t * container,
         }
     }
 
-    unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_META_SETS,
-                               NULL, action->meta, NULL, FALSE, data_set->now);
-
-    unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_ATTR_SETS,
-                               NULL, action->meta, NULL, FALSE, data_set->now);
-
 #if ENABLE_VERSIONED_ATTRS
     rsc_details = pe_rsc_action_details(action);
     pe_unpack_versioned_attributes(data_set->input, xml_obj, XML_TAG_ATTR_SETS, NULL,