File bug-948989_pacemaker-systemd-long-stop.patch of Package pacemaker.9287

commit a9ec9184c475c1f55f7fda7128ae6e3eb00272d9
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Fri Nov 21 10:57:18 2014 +1100

    Fix: systemd: Correctly handle long running stop actions

Index: pacemaker/lib/services/systemd.c
===================================================================
--- pacemaker.orig/lib/services/systemd.c
+++ pacemaker/lib/services/systemd.c
@@ -433,6 +433,8 @@ systemd_unit_exec(svc_action_t * op, gbo
             op->rc = PCMK_OCF_OK;
         } else if (g_strcmp0(state, "activating") == 0) {
             op->rc = PCMK_OCF_PENDING;
+        } else if (g_strcmp0(state, "deactivating") == 0) {
+            op->rc = PCMK_OCF_PENDING;
         } else {
             op->rc = PCMK_OCF_NOT_RUNNING;
         }
Index: pacemaker/lrmd/lrmd.c
===================================================================
--- pacemaker.orig/lrmd/lrmd.c
+++ pacemaker/lrmd/lrmd.c
@@ -733,10 +733,18 @@ action_complete(svc_action_t * action)
             cmd->real_action = cmd->action;
             cmd->action = strdup("monitor");
 
+        } else if(cmd->exec_rc == PCMK_OCF_OK && safe_str_eq(cmd->action, "stop")) {
+            goagain = true;
+            cmd->real_action = cmd->action;
+            cmd->action = strdup("monitor");
+
         } else if(cmd->real_action) {
             /* Ok, so this is the follow up monitor action to check if start actually completed */
             if(cmd->lrmd_op_status == PCMK_LRM_OP_DONE && cmd->exec_rc == PCMK_OCF_PENDING) {
                 goagain = true;
+
+            } else if(cmd->lrmd_op_status == PCMK_LRM_OP_DONE && cmd->exec_rc == PCMK_OCF_NOT_RUNNING && safe_str_eq(cmd->real_action, "stop")) {
+                cmd->exec_rc = PCMK_OCF_OK;
             }
         }
     }
openSUSE Build Service is sponsored by