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

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).

Index: pacemaker-1.1.16+20170320.77ea74d/lib/pengine/utils.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/lib/pengine/utils.c
+++ pacemaker-1.1.16+20170320.77ea74d/lib/pengine/utils.c
@@ -716,9 +716,21 @@ unpack_operation(action_t * action, xmlN
 
     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;
 
@@ -730,11 +742,6 @@ unpack_operation(action_t * action, xmlN
         }
     }
 
-    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);
     g_hash_table_remove(action->meta, "id");
 
     field = XML_LRM_ATTR_INTERVAL;
openSUSE Build Service is sponsored by