while(xml_resources != NULL) {
xml_child_iter( xml_resources, xml_obj, XML_CIB_TAG_RESOURCE,
unpack_resources(xmlNodePtr xml_resources,		 GListPtr *resources,		 GListPtr *actions,		 GListPtr *action_cons,		 GListPtr all_nodes){	crm_verbose("Begining unpack...");	while(xml_resources != NULL) {		action_t *action_stop  = NULL;		action_t *action_start = NULL;		xmlNodePtr xml_obj     = xml_resources;		const char *id         = xmlGetProp(xml_obj, XML_ATTR_ID);		const char *stopfail   = xmlGetProp(xml_obj, "on_stopfail");		const char *version    = xmlGetProp(xml_obj, XML_ATTR_VERSION);		resource_t *new_rsc = NULL;		const char *priority   = xmlGetProp(			xml_obj, XML_CIB_ATTR_PRIORITY);		/* todo: check for null */		xml_resources = xml_resources->next;		crm_verbose("Processing resource...");				if(id == NULL) {			crm_err("Must specify id tag in <resource>");			continue;		}		new_rsc = crm_malloc(sizeof(resource_t));		new_rsc->id		= id;		new_rsc->xml		= xml_obj;		new_rsc->agent		= crm_malloc(sizeof(lrm_agent_t));		new_rsc->agent->class	= xmlGetProp(xml_obj, "class");		new_rsc->agent->type	= xmlGetProp(xml_obj, "type");		new_rsc->agent->version	= version?version:"0.0";		new_rsc->priority	= atof(priority?priority:"0.0"); 		new_rsc->effective_priority = new_rsc->priority;		new_rsc->candidate_colors   = NULL;		new_rsc->fencable_nodes     = NULL;		new_rsc->actions            = NULL;		new_rsc->color		= NULL; 		new_rsc->is_stonith	= FALSE; 		new_rsc->runnable	= TRUE; 		new_rsc->provisional	= TRUE; 		new_rsc->allowed_nodes	= NULL;		new_rsc->rsc_cons	= NULL; 		new_rsc->node_cons	= NULL; 		new_rsc->cur_node	= NULL;		if(safe_str_eq(new_rsc->agent->class, "stonith")) {			new_rsc->is_stonith = TRUE;		}				if(safe_str_eq(stopfail, "ignore")) {			new_rsc->stopfail_type = pesf_ignore;		} else if(safe_str_eq(stopfail, "stonith")) {			new_rsc->stopfail_type = pesf_stonith;		} else {			new_rsc->stopfail_type = pesf_block;		}		action_stop    = action_new(new_rsc, stop_rsc);		*actions       = g_list_append(*actions, action_stop);		new_rsc->stop  = action_stop;		new_rsc->actions =			g_list_append(new_rsc->actions, action_stop);		action_start   = action_new(new_rsc, start_rsc);		*actions       = g_list_append(*actions, action_start);		new_rsc->start = action_start;		new_rsc->actions =			g_list_append(new_rsc->actions, action_start);		order_new(action_stop, action_start, pecs_startstop, action_cons);		*resources = g_list_append(*resources, new_rsc);			crm_debug_action(print_resource("Added", new_rsc, FALSE));	}	*resources = g_list_sort(*resources, sort_rsc_priority);	return TRUE;}