File bug-917625_pacemaker-crmd-all-peers-need-to-track-node-shutdown-requests.patch of Package pacemaker.9287
From 23b5f07fc15fd8436ff70883770349390771f8eb Mon Sep 17 00:00:00 2001
From: Andrew Beekhof <andrew@beekhof.net>
Date: Thu, 26 Mar 2015 10:48:04 +1100
Subject: [PATCH] Fix: crmd: All peers need to track node shutdown requests
This allows them to have the correct value for 'expected status' if they ever
become elected as DC at a point when multiple nodes died.
---
crmd/control.c | 2 +-
crmd/messages.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/crmd/control.c b/crmd/control.c
index 108069d990..2fd8a07526 100644
--- a/crmd/control.c
+++ b/crmd/control.c
@@ -213,7 +213,7 @@ do_shutdown_req(long long action,
xmlNode *msg = NULL;
crm_info("Sending shutdown request to %s", crm_str(fsa_our_dc));
- msg = create_request(CRM_OP_SHUTDOWN_REQ, NULL, NULL, CRM_SYSTEM_DC, CRM_SYSTEM_CRMD, NULL);
+ msg = create_request(CRM_OP_SHUTDOWN_REQ, NULL, NULL, CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
/* set_bit(fsa_input_register, R_STAYDOWN); */
if (send_cluster_message(NULL, crm_msg_crmd, msg, TRUE) == FALSE) {
diff --git a/crmd/messages.c b/crmd/messages.c
index eea4f7bacd..4c47617c1e 100644
--- a/crmd/messages.c
+++ b/crmd/messages.c
@@ -667,6 +667,16 @@ handle_request(xmlNode * stored_msg, enum crmd_fsa_cause cause)
return I_NULL;
}
+ if (strcmp(op, CRM_OP_SHUTDOWN_REQ) == 0) {
+ const char *from = crm_element_value(stored_msg, F_CRM_HOST_FROM);
+ crm_node_t *node = crm_find_peer(0, from);
+
+ crm_update_peer_expected(__FUNCTION__, node, CRMD_JOINSTATE_DOWN);
+ if(AM_I_DC == FALSE) {
+ return I_NULL; /* Done */
+ }
+ }
+
/*========== DC-Only Actions ==========*/
if (AM_I_DC) {
if (strcmp(op, CRM_OP_JOIN_ANNOUNCE) == 0) {