File pacemaker-pengine-check-for-duplicate-intervals-properly.patch of Package pacemaker.22685

commit d4d112feb3a7281aca7663a7b952c6e3c82fb447
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Wed Mar 7 13:34:07 2018 -0600

    Low: pengine: check for duplicate intervals properly
    
    Previously, it would compare the user's interval specification of two actions
    when checking whether they were duplicates. However, this would fail to detect
    (for example) that "30s", "30000ms", and "P30S" are all equivalent.
    
    Now, it parses the specifications into milliseconds and compares numerically.

Index: pacemaker-1.1.18+20180406.19c7be5c7/pengine/native.c
===================================================================
--- pacemaker-1.1.18+20180406.19c7be5c7.orig/pengine/native.c
+++ pacemaker-1.1.18+20180406.19c7be5c7/pengine/native.c
@@ -600,12 +600,13 @@ native_color(resource_t * rsc, node_t *
 }
 
 static gboolean
-is_op_dup(resource_t * rsc, const char *name, const char *interval)
+is_op_dup(resource_t *rsc, const char *name, guint interval_ms)
 {
     gboolean dup = FALSE;
     const char *id = NULL;
     const char *value = NULL;
     xmlNode *operation = NULL;
+    guint interval2_ms = 0;
 
     CRM_ASSERT(rsc);
     for (operation = __xml_first_child(rsc->ops_xml); operation != NULL;
@@ -617,11 +618,8 @@ is_op_dup(resource_t * rsc, const char *
             }
 
             value = crm_element_value(operation, XML_LRM_ATTR_INTERVAL);
-            if (value == NULL) {
-                value = "0";
-            }
-
-            if (safe_str_neq(value, interval)) {
+            interval2_ms = crm_get_interval(value);
+            if (interval_ms != interval2_ms) {
                 continue;
             }
 
@@ -678,7 +676,7 @@ RecurringOp(resource_t * rsc, action_t *
     }
 
     name = crm_element_value(operation, "name");
-    if (is_op_dup(rsc, name, interval)) {
+    if (is_op_dup(rsc, name, interval_ms)) {
         return;
     }
 
@@ -892,7 +890,7 @@ RecurringOp_Stopped(resource_t * rsc, ac
     }
 
     name = crm_element_value(operation, "name");
-    if (is_op_dup(rsc, name, interval)) {
+    if (is_op_dup(rsc, name, interval_ms)) {
         return;
     }
 
openSUSE Build Service is sponsored by