File pacemaker-libcrmservice-dont-consider-a-cancelled-recurring-operation-as-failed.patch of Package pacemaker.10378

commit abec371d2bad88f5cb23f05ebb115f00466c01c3
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Wed May 9 16:04:10 2018 -0500

    Low: libcrmservice: don't consider a cancelled recurring operation as failed
    
    This takes care of an recurring (pun intended) and annoying regression test
    issue when cancelling LSB monitors.
    
    If an instance of the recurring operation was *not* in-flight at the time,
    services_action_cancel() would set the operation status to cancelled and leave
    the rc alone (which would be 0).
    
    If an instance *was* in-flight, the instance would be killed, and the child
    exit handler would set the status to error and the rc to PCMK_OCF_SIGNAL
    (which would get mapped to PCMK_OCF_UNKNOWN_ERROR for client notification).
    The result would cause the regression test ignore the notification and get a
    timeout instead.
    
    Now, the exit handler also sets status cancelled and rc 0 in this situation.
    
    This should benefit actual cluster usage in the same situation, though those
    effects have not been extensively traced. The behavioral difference would be in
    process_lrm_event(). Most likely it avoids spurious monitor failures.

diff --git a/lib/services/services_linux.c b/lib/services/services_linux.c
index 6263cb14d..bd22777b9 100644
--- a/lib/services/services_linux.c
+++ b/lib/services/services_linux.c
@@ -291,9 +291,16 @@ operation_finished(mainloop_child_t * p, pid_t pid, int core, int signo, int exi
             op->status = PCMK_LRM_OP_TIMEOUT;
             op->rc = PCMK_OCF_TIMEOUT;
 
+        } else if (op->cancel) {
+            /* If an in-flight recurring operation was killed because it was
+             * cancelled, don't treat that as a failure.
+             */
+            crm_info("%s - terminated with signal %d", prefix, signo);
+            op->status = PCMK_LRM_OP_CANCELLED;
+            op->rc = PCMK_OCF_OK;
+
         } else {
-            do_crm_log_unlikely((op->cancel) ? LOG_INFO : LOG_WARNING,
-                                "%s - terminated with signal %d", prefix, signo);
+            crm_warn("%s - terminated with signal %d", prefix, signo);
             op->status = PCMK_LRM_OP_ERROR;
             op->rc = PCMK_OCF_SIGNAL;
         }
openSUSE Build Service is sponsored by