&max_call_id, &failed, data_set);
&max_call_id, &on_fail, data_set);
unpack_lrm_rsc_state(node_t *node, crm_data_t * lrm_rsc_list, pe_working_set_t *data_set){	gboolean delete_resource = FALSE;	enum rsc_role_e saved_role = RSC_ROLE_UNKNOWN;	const char *rsc_id    = NULL;	const char *node_id   = node->details->uname;	const char *rsc_state = NULL;	int max_call_id = -1;	gboolean is_duped_clone = FALSE;	resource_t *rsc   = NULL;	GListPtr op_list = NULL;	GListPtr sorted_op_list = NULL;	char *alt_rsc_id = NULL;	gboolean failed = FALSE;		const char *value = NULL;	const char *old_value = NULL;	const char *attr_list[] = {		XML_ATTR_TYPE, 		XML_AGENT_ATTR_CLASS, 		XML_AGENT_ATTR_PROVIDER	};		CRM_DEV_ASSERT(node != NULL);	if(crm_assert_failed) {		return FALSE;	}		xml_child_iter(		lrm_rsc_list, rsc_entry, XML_LRM_TAG_RESOURCE,				delete_resource = FALSE;		rsc_id    = crm_element_value(rsc_entry, XML_ATTR_ID);		rsc_state = crm_element_value(rsc_entry, XML_LRM_ATTR_RSCSTATE);				rsc = NULL;		is_duped_clone = FALSE;		alt_rsc_id = crm_strdup(rsc_id);		while(rsc == NULL) {			crm_debug_3("looking for: %s", alt_rsc_id);			rsc = pe_find_resource(data_set->resources, alt_rsc_id);			/* no match */			if(rsc == NULL) {				crm_debug_3("not found");				break;								/* not running anywhere else */			} else if(rsc->running_on == NULL) {				crm_debug_3("not active yet");				break;				/* always unique */			} else if(rsc->globally_unique) {				crm_debug_3("unique");				break;				/* running somewhere already but we dont care				 *   find another clone instead				 */			} else {				crm_debug_2("find another one");				rsc = NULL;				is_duped_clone = TRUE;				increment_clone(alt_rsc_id);			}		}		crm_free(alt_rsc_id);		if(is_duped_clone && rsc != NULL) {			crm_info("Internally renamed %s on %s to %s",				 rsc_id, node->details->uname, rsc->id);			rsc->name = rsc_id;		}				crm_debug_3("[%s] Processing %s on %s (%s)",			    crm_element_name(rsc_entry),			    rsc_id, node_id, rsc_state);		if(rsc == NULL) {			crm_data_t *xml_rsc = create_xml_node(				NULL, XML_CIB_TAG_RESOURCE);			crm_log_xml_info(rsc_entry, "Orphan resource");			pe_config_warn("Nothing known about resource"				       " %s running on %s", rsc_id, node_id);						copy_in_properties(xml_rsc, rsc_entry);						common_unpack(xml_rsc, &rsc, NULL, data_set);			rsc->orphan = TRUE;						data_set->resources = g_list_append(				data_set->resources, rsc);			if(data_set->stop_rsc_orphans == FALSE			   && is_duped_clone == FALSE) {				rsc->is_managed = FALSE;			} else {				crm_info("Making sure orphan %s is stopped",					 rsc_id);							print_resource(LOG_DEBUG_3, "Added orphan",					       rsc, FALSE);								CRM_DEV_ASSERT(rsc != NULL);				slist_iter(					any_node, node_t, data_set->nodes, lpc,					rsc2node_new(						"__orphan_dont_run__", rsc,						-INFINITY, any_node, data_set);					);			}					} else {			int attr_lpc = 0;			gboolean force_restart = FALSE;			for(; attr_lpc < DIMOF(attr_list); attr_lpc++) {				value = crm_element_value(					rsc->xml, attr_list[attr_lpc]);				old_value = crm_element_value(					rsc_entry, attr_list[attr_lpc]);				if(safe_str_eq(value, old_value)) {					continue;				}								force_restart = TRUE;				crm_notice("Forcing restart of %s on %s,"					   " %s changed: %s -> %s",					   rsc->id, node->details->uname,					   attr_list[attr_lpc],					   crm_str(old_value), crm_str(value));			}			if(force_restart) {				/* make sure the restart happens */				stop_action(rsc, node, FALSE);				rsc->start_pending = TRUE;				delete_resource = TRUE;			}		}						max_call_id = -1;		op_list = NULL;		sorted_op_list = NULL;				xml_child_iter(			rsc_entry, rsc_op, XML_LRM_TAG_RSC_OP,			op_list = g_list_append(op_list, rsc_op);			);		if(op_list == NULL) {			continue;		}				failed = FALSE;		saved_role = rsc->role;		rsc->role = RSC_ROLE_STOPPED;		sorted_op_list = g_list_sort(op_list, sort_op_by_callid);		slist_iter(			rsc_op, crm_data_t, sorted_op_list, lpc,			unpack_rsc_op(rsc, node, rsc_op,				      &max_call_id, &failed, data_set);			);		/* no need to free the contents */		g_list_free(sorted_op_list);		crm_debug("Resource %s is %s on %s",			  rsc->id, role2text(rsc->role), node->details->uname);		rsc->known_on = g_list_append(rsc->known_on, node); 		if(rsc->role != RSC_ROLE_STOPPED) { 			crm_debug_2("Adding %s to %s", rsc->id, node->details->uname);			native_add_running(rsc, node, data_set);			rsc->failed = failed;					} else {			char *key = stop_key(rsc);			GListPtr possible_matches = find_actions(rsc->actions, key, node);			slist_iter(stop, action_t, possible_matches, lpc,				   stop->optional = TRUE;				);			crm_free(key);			/* 			if(rsc->failed == FALSE && node->details->online) { *//* 				delete_resource = TRUE; *//* 			}			 */		}		if(delete_resource) {			DeleteRsc(rsc, node, data_set);		}				if(saved_role > rsc->role) {			rsc->role = saved_role;		}		);		return TRUE;}