node_id   = crm_element_value(rsc_entry, XML_LRM_ATTR_TARGET);
unpack_lrm_rsc_state(node_t *node, crm_data_t * lrm_rsc,		     GListPtr rsc_list, GListPtr nodes,		     GListPtr *actions, GListPtr *placement_constraints){	const char *rsc_id    = NULL;	const char *node_id   = NULL;	const char *rsc_state = NULL;	const char *op_status = NULL;	const char *last_rc   = NULL;	const char *last_op   = NULL;	resource_t *rsc_lh    = NULL;	op_status_t  action_status_i = LRM_OP_ERROR;	xml_child_iter(		lrm_rsc, rsc_entry, XML_LRM_TAG_RESOURCE,				rsc_id    = crm_element_value(rsc_entry, XML_ATTR_ID);		node_id   = crm_element_value(rsc_entry, XML_LRM_ATTR_TARGET);		rsc_state = crm_element_value(rsc_entry, XML_LRM_ATTR_RSCSTATE);		op_status = crm_element_value(rsc_entry, XML_LRM_ATTR_OPSTATUS);		last_rc   = crm_element_value(rsc_entry, XML_LRM_ATTR_RC);		last_op   = crm_element_value(rsc_entry, XML_LRM_ATTR_LASTOP);				rsc_lh    = pe_find_resource(rsc_list, rsc_id);		crm_verbose("[%s] Processing %s on %s (%s)",			    crm_element_name(rsc_entry), rsc_id, node_id, rsc_state);		if(rsc_lh == NULL) {			crm_err("Could not find a match for resource"				" %s in %s's status section",				rsc_id, node_id);			continue;		} else if(op_status == NULL) {			crm_err("Invalid resource status entry for %s in %s",				rsc_id, node_id);			continue;		}				action_status_i = atoi(op_status);		if(node->details->unclean) {			crm_debug("Node %s (where %s is running) is unclean."				  " Further action depends on the value of %s",				  node->details->uname, rsc_lh->id,				  XML_RSC_ATTR_STOPFAIL);						/* map the status to an error and then handle as a			 * failed resource.			 *//* 			action_status_i = LRM_OP_ERROR; */		} else if(action_status_i == (op_status_t)-1) {			/*			 * TODO: this may need some more thought			 * Some cases:			 * - PE reinvoked with pending action that will succeed			 * - PE reinvoked with pending action that will fail			 * - After DC election			 * - After startup			 *			 * pending start - required start			 * pending stop  - required stop			 * pending <any> on unavailable node - stonith			 *			 * For now this should do			 */			if(safe_str_eq(last_op, "stop")) {				/* map this to a timeout so it is re-issued */				action_status_i = LRM_OP_TIMEOUT;			} else {				/* map this to a "done" so it is not marked				 * as failed, then make sure it is re-issued				 */				action_status_i = LRM_OP_DONE;				rsc_lh->start_pending = TRUE;				if(have_quorum == TRUE				   || no_quorum_policy == no_quorum_ignore) {					action_new(rsc_lh, start_rsc, NULL, NULL);				}			}		}		switch(action_status_i) {			case LRM_OP_DONE:				unpack_healthy_resource(					placement_constraints, actions,					rsc_entry, rsc_lh,node);				break;			case LRM_OP_ERROR:			case LRM_OP_TIMEOUT:			case LRM_OP_NOTSUPPORTED:				unpack_failed_resource(placement_constraints, 						       rsc_entry, rsc_lh,node);				break;			case LRM_OP_PENDING:						case LRM_OP_CANCELLED:				/* do nothing?? */				crm_warn("Dont know what to do for cancelled ops yet");				break;		}		);		return TRUE;}