File pacemaker-crmd-clear-failure-only-for-requested-node.patch of Package pacemaker.14737
commit 8830b6f767fb94fcd985c95269a12232f64aafcd
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Wed Feb 22 16:58:19 2017 -0600
Fix: crmd: clear failure only for requested node
The PE schedules CRM_OP_CLEAR_FAILCOUNT operations to clear a particular resource on a
particular node. When the operation was introduced in a2b997cf, the crmd never checked
the node, but always cleared fail-count and last-failure for all nodes.
Commit 42316ba7 attempted to use the node name, but checked the wrong XML parent
for the information. This commit corrects that.
Index: pacemaker/crmd/messages.c
===================================================================
--- pacemaker.orig/crmd/messages.c
+++ pacemaker/crmd/messages.c
@@ -623,10 +623,14 @@ handle_failcount_op(xmlNode * stored_msg
const char *rsc = NULL;
const char *uname = NULL;
gboolean is_remote_node = FALSE;
- xmlNode *xml_rsc = get_xpath_object("//" XML_CIB_TAG_RESOURCE, stored_msg, LOG_ERR);
+ xmlNode *xml_op = get_message_xml(stored_msg, F_CRM_DATA);
- if (xml_rsc) {
- rsc = ID(xml_rsc);
+ if (xml_op) {
+ xmlNode *xml_rsc = first_named_child(xml_op, XML_CIB_TAG_RESOURCE);
+
+ if (xml_rsc) {
+ rsc = ID(xml_rsc);
+ }
}
if (rsc == NULL) {
@@ -634,8 +638,8 @@ handle_failcount_op(xmlNode * stored_msg
return I_NULL;
}
- uname = crm_element_value(stored_msg, XML_LRM_ATTR_TARGET);
- if (crm_element_value(stored_msg, XML_LRM_ATTR_ROUTER_NODE)) {
+ uname = crm_element_value(xml_op, XML_LRM_ATTR_TARGET);
+ if (crm_element_value(xml_op, XML_LRM_ATTR_ROUTER_NODE)) {
is_remote_node = TRUE;
}