File pacemaker-libpe_status-correct-default-timeout-for-probes.patch of Package pacemaker.14737

commit 78802fff1db6b800cc179627070fdc1a2c6d7084
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Wed Dec 6 11:22:34 2017 -0600

    Fix: libpe_status: use correct default timeout for probes
    
    Previously, if timeout were set in op_defaults, probes without an explicitly
    configured timeout would use that value rather than the minimum-interval
    monitor's. This was contrary the behavior of default-action-timeout, which
    would not override the minimum-interval monitor's value.
    
    Now, timeout in op_defaults behaves the same as default-action-timeout.

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
@@ -703,6 +703,18 @@ find_min_interval_mon(resource_t * rsc,
     return op;
 }
 
+/*!
+ * \brief Unpack operation XML into an action structure
+ *
+ * Unpack an operation's meta-attributes (normalizing the interval, timeout,
+ * and start delay values as integer milliseconds), requirements, and
+ * failure policy.
+ *
+ * \param[in,out] action     Action to unpack into
+ * \param[in]     xml_obj    Operation XML (or NULL if all defaults)
+ * \param[in]     container  Resource that contains affected resource, if any
+ * \param[in]     data_set   Cluster state
+ */
 void
 unpack_operation(action_t * action, xmlNode * xml_obj, resource_t * container,
                  pe_working_set_t * data_set)
@@ -716,6 +728,23 @@ unpack_operation(action_t * action, xmlN
 
     CRM_CHECK(action->rsc != NULL, return);
 
+    // Probe timeouts default to minimum-interval monitor's
+    if ((xml_obj == NULL) && action &&
+        safe_str_eq(action->task, RSC_STATUS) && (interval == 0)) {
+
+        xmlNode *min_interval_mon = find_min_interval_mon(action->rsc, FALSE);
+
+        if (min_interval_mon) {
+            value = crm_element_value(min_interval_mon, XML_ATTR_TIMEOUT);
+            if (value) {
+                crm_trace("\t%s defaults to minimum-interval monitor's timeout '%s'",
+                          action->uuid, value);
+                g_hash_table_insert(action->meta, strdup(XML_ATTR_TIMEOUT),
+                                    strdup(value));
+            }
+        }
+    }
+
     // 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);
@@ -994,16 +1023,6 @@ unpack_operation(action_t * action, xmlN
 
     field = XML_ATTR_TIMEOUT;
     value = g_hash_table_lookup(action->meta, field);
-    if (value == NULL && xml_obj == NULL && safe_str_eq(action->task, RSC_STATUS) && interval == 0) {
-        xmlNode *min_interval_mon = find_min_interval_mon(action->rsc, FALSE);
-
-        if (min_interval_mon) {
-            value = crm_element_value(min_interval_mon, XML_ATTR_TIMEOUT);
-            pe_rsc_trace(action->rsc,
-                         "\t%s uses the timeout value '%s' from the minimum interval monitor",
-                         action->uuid, value);
-        }
-    }
     if (value == NULL) {
         value = pe_pref(data_set->config_hash, "default-action-timeout");
     }
openSUSE Build Service is sponsored by