File pacemaker-libservices-cancel-in-flight-systemd-op.patch of Package pacemaker.14737

commit deabcc5a6aa93dadf0b20364715b559a5b9848ac
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Tue Feb 28 15:48:11 2017 -0600

    Fix: libservices: properly cancel in-flight systemd/upstart op

diff --git a/lib/services/services.c b/lib/services/services.c
index dba4e6675..4aa4c014e 100644
--- a/lib/services/services.c
+++ b/lib/services/services.c
@@ -89,6 +89,21 @@ resources_find_service_class(const char *agent)
     return NULL;
 }
 
+/*!
+ * \internal
+ * \brief Check whether op is in-flight systemd or upstart op
+ *
+ * \param[in] op  Operation to check
+ *
+ * \return TRUE if op is in-flight systemd or upstart op
+ */
+static inline gboolean
+inflight_systemd_or_upstart(svc_action_t *op)
+{
+    return (safe_str_eq(op->standard, "systemd")
+            || safe_str_eq(op->standard, "upstart"))
+            && (g_list_find(inflight_ops, op) != NULL);
+}
 
 svc_action_t *
 resources_action_create(const char *name, const char *standard, const char *provider,
@@ -513,6 +528,18 @@ services_action_cancel(const char *name, const char *action, int interval)
         goto done;
     }
 
+    /* In-flight systemd and upstart ops don't have a pid. The relevant handlers
+     * will call operation_finalize() when the operation completes.
+     * @TODO: Can we request early termination, maybe using
+     * dbus_pending_call_cancel()?
+     */
+    if (inflight_systemd_or_upstart(op)) {
+        crm_info("Will cancel %s op %s when in-flight instance completes",
+                 op->standard, op->id);
+        cancelled = FALSE;
+        goto done;
+    }
+
     /* Otherwise, operation is not in-flight, just report as cancelled */
     op->status = PCMK_LRM_OP_CANCELLED;
     if (op->opaque->callback) {
openSUSE Build Service is sponsored by