op_status = xmlGetProp(rsc_entry, XML_LRM_ATTR_OPCODE); last_rc   = xmlGetProp(rsc_entry, XML_LRM_ATTR_RCCODE);
op_status = xmlGetProp(rsc_entry, XML_LRM_ATTR_OPSTATUS); last_rc   = xmlGetProp(rsc_entry, XML_LRM_ATTR_RC);
unpack_lrm_rsc_state(node_t *node, xmlNodePtr lrm_rsc,		     GListPtr rsc_list, GListPtr nodes,		     GListPtr *actions, GListPtr *node_constraints){	xmlNodePtr rsc_entry  = NULL;		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  rsc_code_i = LRM_OP_ERROR;	xmlNodePtr stonith_list = NULL;		while(lrm_rsc != NULL) {		rsc_entry = lrm_rsc;		lrm_rsc   = lrm_rsc->next;				rsc_id    = xmlGetProp(rsc_entry, XML_ATTR_ID);		node_id   = xmlGetProp(rsc_entry, XML_LRM_ATTR_TARGET);		rsc_state = xmlGetProp(rsc_entry, XML_LRM_ATTR_RSCSTATE);		op_status = xmlGetProp(rsc_entry, XML_LRM_ATTR_OPCODE);		last_rc   = xmlGetProp(rsc_entry, XML_LRM_ATTR_RCCODE);		last_op   = xmlGetProp(rsc_entry, XML_LRM_ATTR_LASTOP);				rsc_lh    = pe_find_resource(rsc_list, rsc_id);		crm_verbose("[%s] Processing %s on %s (%s)",			    rsc_entry->name, 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(last_rc == NULL) {			crm_err("Invalid resource status entry for %s in %s",				rsc_id, node_id);			continue;		}		stonith_list = rsc_entry->children;		while(stonith_list != NULL) {			node_t *node = pe_find_node(				nodes, xmlGetProp(stonith_list, "id"));			stonith_list = stonith_list->next;			rsc_lh->fencable_nodes = g_list_append(				rsc_lh->fencable_nodes, node_copy(node));					}				rsc_code_i = atoi(last_rc);		if(rsc_code_i == -1) {			/*			 * TODO: this needs 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 */				rsc_code_i = LRM_OP_TIMEOUT;			} else {				/* map this to a "done" so it is not marked				 * as failed, then make sure it is re-issued				 */				rsc_code_i = LRM_OP_DONE;				rsc_lh->start->optional = FALSE;			}		}		switch(rsc_code_i) {			case LRM_OP_DONE:				unpack_healthy_resource(					node_constraints, actions,					rsc_entry, rsc_lh,node);				break;			case LRM_OP_ERROR:			case LRM_OP_TIMEOUT:			case LRM_OP_NOTSUPPORTED:				unpack_failed_resource(					node_constraints, actions, 					rsc_entry, rsc_lh,node);				break;			case LRM_OP_CANCELLED:				/* do nothing?? */				crm_warn("Dont know what to do for cancelled ops yet");				break;		}	}	return TRUE;}