rsc->role = RSC_ROLE_STOPPED;
unpack_lrm_rsc_state(node_t *node, crm_data_t * lrm_rsc_list,		     pe_working_set_t *data_set){	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;	resource_t *rsc   = NULL;	GListPtr op_list = NULL;	GListPtr sorted_op_list = NULL;		CRM_DEV_ASSERT(node != NULL);	if(crm_assert_failed) {		return FALSE;	}		xml_child_iter(		lrm_rsc_list, rsc_entry, XML_LRM_TAG_RESOURCE,				rsc_id    = crm_element_value(rsc_entry, XML_ATTR_ID);		rsc_state = crm_element_value(rsc_entry, XML_LRM_ATTR_RSCSTATE);				rsc    = pe_find_resource(data_set->resources, 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_log_xml_debug(rsc_entry, "Invalid status entry");			pe_warn("Nothing known about resource"				" %s running on %s", rsc_id, node_id);						if(data_set->stop_rsc_orphans == FALSE) {				continue;			} else {				crm_data_t *xml_rsc = create_xml_node(					NULL, XML_CIB_TAG_RESOURCE);				crm_info("Making sure orphan %s is stopped",					rsc_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);							crm_action_debug_3(					print_resource(						"Added orphan", rsc, FALSE));								CRM_DEV_ASSERT(rsc != NULL);				slist_iter(					any_node, node_t, data_set->nodes, lpc,					rsc2node_new(						"dont_run__orphan", rsc,						-INFINITY, any_node, data_set);					);			}		}				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;		}				sorted_op_list = g_list_sort(op_list, sort_op_by_callid);		saved_role = rsc->role;		slist_iter(			rsc_op, crm_data_t, sorted_op_list, lpc,			unpack_rsc_op(rsc, node, rsc_op,				      &max_call_id, data_set);			);		/* no need to free the contents */		g_list_free(sorted_op_list); 		if(rsc->role != RSC_ROLE_STOPPED) { 			native_add_running(rsc, node, data_set);		} else if(rsc->failed == FALSE && node->details->online) {			action_t *delete = delete_action(rsc, node);			/* just in case we try and start it back on this node */			custom_action_order(				rsc, NULL, delete, rsc, start_key(rsc), NULL,				pe_ordering_optional, data_set);		}				if(saved_role > rsc->role) {			rsc->role = saved_role;		}		);		return TRUE;}