Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
pacemaker.9287
bug-918839_pacemaker-crm_mon-fill-crm_notify_no...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bug-918839_pacemaker-crm_mon-fill-crm_notify_node-in-traps-with-nodes-uname.patch of Package pacemaker.9287
From acbda524fa9e242574da90ba36f3b3a547f7ba3a Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Fri, 20 Feb 2015 17:39:38 +0100 Subject: [PATCH] Fix: crm_mon: Fill CRM_notify_node in traps with node's uname rather than node's id if possible --- tools/crm_mon.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tools/crm_mon.c b/tools/crm_mon.c index 0cd4f43641..841dd07886 100644 --- a/tools/crm_mon.c +++ b/tools/crm_mon.c @@ -2422,7 +2422,7 @@ send_smtp_trap(const char *node, const char *rsc, const char *task, int target_r } static void -handle_rsc_op(xmlNode * xml, const char *node) +handle_rsc_op(xmlNode * xml, const char *node_id) { int rc = -1; int status = -1; @@ -2438,6 +2438,7 @@ handle_rsc_op(xmlNode * xml, const char *node) const char *magic = NULL; const char *id = NULL; char *update_te_uuid = NULL; + const char *node = NULL; xmlNode *n = xml; xmlNode * rsc_op = xml; @@ -2446,7 +2447,7 @@ handle_rsc_op(xmlNode * xml, const char *node) xmlNode *cIter; for(cIter = xml->children; cIter; cIter = cIter->next) { - handle_rsc_op(cIter, node); + handle_rsc_op(cIter, node_id); } return; @@ -2475,18 +2476,24 @@ handle_rsc_op(xmlNode * xml, const char *node) goto bail; } + node = crm_element_value(rsc_op, XML_LRM_ATTR_TARGET); + while (n != NULL && safe_str_neq(XML_CIB_TAG_STATE, TYPE(n))) { n = n->parent; } - if(node == NULL) { + if(node == NULL && n) { node = crm_element_value(n, XML_ATTR_UNAME); } - if (node == NULL) { + if (node == NULL && n) { node = ID(n); } + if (node == NULL) { + node = node_id; + } + if (node == NULL) { crm_err("No node detected for event %s (%s)", magic, id); goto bail; @@ -2597,7 +2604,10 @@ static void crm_diff_update_v2(const char *event, xmlNode * msg) xmlNode *status = first_named_child(match, XML_CIB_TAG_STATUS); for (state = __xml_first_child(status); state != NULL; state = __xml_next(state)) { - node = ID(state); + node = crm_element_value(state, XML_ATTR_UNAME); + if (node == NULL) { + node = ID(state); + } handle_rsc_op(state, node); } @@ -2605,12 +2615,18 @@ static void crm_diff_update_v2(const char *event, xmlNode * msg) xmlNode *state = NULL; for (state = __xml_first_child(match); state != NULL; state = __xml_next(state)) { - node = ID(state); + node = crm_element_value(state, XML_ATTR_UNAME); + if (node == NULL) { + node = ID(state); + } handle_rsc_op(state, node); } } else if(strcmp(name, XML_CIB_TAG_STATE) == 0) { - node = ID(match); + node = crm_element_value(match, XML_ATTR_UNAME); + if (node == NULL) { + node = ID(match); + } handle_rsc_op(match, node); } else if(strcmp(name, XML_CIB_TAG_LRM) == 0) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor