crm_debug("Matched action %d", action->id);
crm_debug("Matched action (%d) %s", action->id, this_event);
match_graph_event(action_t *action, crm_data_t *event, const char *event_node){	const char *allow_fail  = NULL;	const char *this_action = NULL;	const char *this_node   = NULL;	const char *this_uname  = NULL;	const char *this_rsc    = NULL;	const char *magic       = NULL;	char *this_event;	char *update_te_uuid = NULL;	const char *update_event;		action_t *match = NULL;	int op_status_i = -3;	int transition_i = -1;	if(event == NULL) {		crm_debug_4("Ignoring NULL event");		return -1;	}		this_rsc = crm_element_value(action->xml, XML_LRM_ATTR_RSCID);		if(this_rsc == NULL) {		crm_debug_4("Skipping non-resource event");		return -1;	}	crm_debug_3("Processing \"%s\" change", crm_element_name(event));	update_event = crm_element_value(event, XML_ATTR_ID);	magic        = crm_element_value(event, XML_ATTR_TRANSITION_MAGIC);	if(magic == NULL) {/* 		crm_debug("Skipping \"non-change\""); */		crm_log_xml_debug(event, "Skipping \"non-change\"");		return -3;	}		this_action = crm_element_value(action->xml, XML_LRM_ATTR_TASK);	this_node   = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);	this_uname  = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);		this_event  = generate_op_key(this_rsc, this_action, action->interval);	if(safe_str_neq(this_event, update_event)) {		crm_debug_2("Action %d : Event mismatch %s vs. %s",			    action->id, this_event, update_event);	} else if(safe_str_neq(this_node, event_node)) {		crm_debug_2("Action %d : Node mismatch %s (%s) vs. %s",			    action->id, this_node, this_uname, event_node);	} else {		match = action;	}		crm_free(this_event);	if(match == NULL) {		return -1;	}		crm_debug("Matched action %d", action->id);	CRM_DEV_ASSERT(decode_transition_magic(			       magic, &update_te_uuid,			       &transition_i, &op_status_i));		if(transition_i == -1) {		/* we never expect these - recompute */		crm_err("Detected an action initiated outside of a transition");		crm_log_message(LOG_ERR, event);		return -5;			} else if(safe_str_neq(update_te_uuid, te_uuid)) {		crm_err("Detected an action from a different transitioner:"			" %s vs. %s", update_te_uuid, te_uuid);		return -6;			} else if(transition_counter != transition_i) {		crm_warn("Detected an action from a different transition:"			 " %d vs. %d", transition_i, transition_counter);		return -3;	}		/* stop this event's timer if it had one */	stop_te_timer(match->timer);	/* Process OP status */	allow_fail = crm_element_value(match->xml, "allow_fail");	switch(op_status_i) {		case -3:			crm_err("Action returned the same as last time..."				" whatever that was!");			crm_log_message(LOG_ERR, event);			break;		case LRM_OP_PENDING:			crm_debug("Ignoring pending operation");			return -4;			break;		case LRM_OP_DONE:			break;		case LRM_OP_ERROR:		case LRM_OP_TIMEOUT:		case LRM_OP_NOTSUPPORTED:			crm_warn("Action %s on %s failed: %s",				 update_event, event_node,				 op_status2text(op_status_i));			if(FALSE == crm_is_true(allow_fail)) {				send_complete("Action failed", event,					      te_failed, i_cancel);				return -2;			}			break;		case LRM_OP_CANCELLED:			/* do nothing?? */			crm_err("Dont know what to do for cancelled ops yet");			break;		default:			crm_err("Unsupported action result: %d", op_status_i);			send_complete("Unsupport action result",				      event, te_failed, i_cancel);			return -2;	}		te_log_action(LOG_INFO, "Action %d confirmed", match->id);	match->complete = TRUE;	process_trigger(match->id);	if(te_fsa_state != s_in_transition) {		return -3;	}	return match->id;}