File pacemaker-crm_resource-wait-for-all-messages-before-exiting.patch of Package pacemaker.10130
commit e3b825a72037538bdb7b181bb39cabc3f121d0d4
Author: Andrew Beekhof <andrew@beekhof.net>
Date: Sun Oct 29 16:33:13 2017 +1100
Fix: crm_resource: Ensure we wait for all messages before exiting
- Wait for deletions from remote nodes too
- Only reset counter if it went backwards past zero
- Start mainloop for the new --cleanup mode
Terminating too early prevents our delete operations being read by the
crmd process.
Index: pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource_runtime.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/tools/crm_resource_runtime.c
+++ pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource_runtime.c
@@ -661,6 +661,7 @@ cli_resource_delete(crm_ipc_t *crmd_chan
* single operation, we might wind up with a wrong idea of the current
* resource state, and we might not re-probe the resource.
*/
+ crmd_replies_needed++;
rc = send_lrm_rsc_op(crmd_channel, CRM_OP_LRM_DELETE, host_uname, rsc->id,
TRUE, data_set);
if (rc != pcmk_ok) {
@@ -669,16 +670,15 @@ cli_resource_delete(crm_ipc_t *crmd_chan
return rc;
}
- if (node->details->remote_rsc == NULL) {
- crmd_replies_needed++;
- }
-
crm_trace("Processing %d mainloop inputs", crmd_replies_needed);
while(g_main_context_iteration(NULL, FALSE)) {
crm_trace("Processed mainloop input, %d still remaining",
crmd_replies_needed);
}
- crmd_replies_needed = 0;
+
+ if(crmd_replies_needed < 0) {
+ crmd_replies_needed = 0;
+ }
rsc_name = rsc_fail_name(rsc);
if (is_remote_node(node)) {