File pacemaker-libpe_status-handle-ISO8601-intervals-when-checking-for-blocking-failures.patch of Package pacemaker.19778

commit 6e480277de38538bc34103306898dfd1a47e612e
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Thu Mar 15 15:08:20 2018 -0500

    Low: libpe_status: handle ISO8601 intervals when checking for blocking failures
    
    crm_get_msec() was used where crm_parse_interval_spec() should have been

Index: pacemaker-1.1.18+20180406.19c7be5c7/lib/pengine/failcounts.c
===================================================================
--- pacemaker-1.1.18+20180406.19c7be5c7.orig/lib/pengine/failcounts.c
+++ pacemaker-1.1.18+20180406.19c7be5c7/lib/pengine/failcounts.c
@@ -34,7 +34,7 @@ is_matched_failure(const char *rsc_id, x
     }
 
     conf_op_name = crm_element_value(conf_op_xml, "name");
-    conf_op_interval = crm_get_msec(crm_element_value(conf_op_xml, "interval"));
+    conf_op_interval = crm_get_interval(crm_element_value(conf_op_xml, "interval"));
     lrm_op_task = crm_element_value(lrm_op_xml, XML_LRM_ATTR_TASK);
     crm_element_value_int(lrm_op_xml, XML_LRM_ATTR_INTERVAL, &lrm_op_interval);
 
@@ -74,21 +74,25 @@ block_failure(node_t *node, resource_t *
               pe_working_set_t *data_set)
 {
     char *xml_name = clone_strip(rsc->id);
+
+    /* @TODO This xpath search occurs after template expansion, but it is unable
+     * to properly detect on-fail in id-ref, operation meta-attributes, or
+     * op_defaults, or evaluate rules.
+     *
+     * Also, on-fail defaults to block (in unpack_operation()) for stop actions
+     * when stonith is disabled.
+     *
+     * Ideally, we'd unpack the operation before this point, and pass in a
+     * meta-attributes table that takes all that into consideration.
+     */
     char *xpath = crm_strdup_printf("//primitive[@id='%s']//op[@on-fail='block']",
                                     xml_name);
+
     xmlXPathObject *xpathObj = xpath_search(rsc->xml, xpath);
     gboolean should_block = FALSE;
 
     free(xpath);
 
-#if 0
-    /* A good idea? */
-    if (rsc->container == NULL && is_not_set(data_set->flags, pe_flag_stonith_enabled)) {
-        /* In this case, stop on-fail defaults to block in unpack_operation() */
-        return TRUE;
-    }
-#endif
-
     if (xpathObj) {
         int max = numXpathResults(xpathObj);
         int lpc = 0;
@@ -109,7 +113,7 @@ block_failure(node_t *node, resource_t *
                 xmlXPathObject *lrm_op_xpathObj = NULL;
 
                 conf_op_name = crm_element_value(pref, "name");
-                conf_op_interval = crm_get_msec(crm_element_value(pref, "interval"));
+                conf_op_interval = crm_get_interval(crm_element_value(pref, "interval"));
 
                 lrm_op_xpath = crm_strdup_printf("//node_state[@uname='%s']"
                                                "//lrm_resource[@id='%s']"
openSUSE Build Service is sponsored by