(*rsc)->priority	   = atoi(value?value:"0");
(*rsc)->priority	   = crm_parse_int(value, "0");
common_unpack(crm_data_t * xml_obj, resource_t **rsc,	      GHashTable *defaults, pe_working_set_t *data_set){	int lpc = 0;	const char *id    = crm_element_value(xml_obj, XML_ATTR_ID);	const char *value = NULL;	const char *allowed_attrs[] = {		XML_CIB_ATTR_PRIORITY,		XML_RSC_ATTR_INCARNATION_MAX,		XML_RSC_ATTR_INCARNATION_NODEMAX,		XML_RSC_ATTR_MASTER_MAX,		XML_RSC_ATTR_MASTER_NODEMAX,		"resource_stickiness"	};	const char *rsc_attrs[] = {		XML_RSC_ATTR_STOPFAIL,		XML_RSC_ATTR_RESTART,		"resource_stickiness",		"multiple_active",		"start_prereq",		"is_managed",		"globally_unique",		"notify"	};			crm_log_xml_debug_3(xml_obj, "Processing resource input...");		if(id == NULL) {		pe_err("Must specify id tag in <resource>");		return FALSE;			} else if(rsc == NULL) {		pe_err("Nowhere to unpack resource into");		return FALSE;			}	crm_malloc0(*rsc, sizeof(resource_t));		if(*rsc == NULL) {		return FALSE;	}		(*rsc)->id   = id;	(*rsc)->name = id;	(*rsc)->xml  = xml_obj;	(*rsc)->ops_xml = find_xml_node(xml_obj, "operations", FALSE);	(*rsc)->variant = get_resource_type(crm_element_name(xml_obj));		if((*rsc)->variant == pe_unknown) {		pe_err("Unknown resource type: %s", crm_element_name(xml_obj));		crm_free(*rsc);		return FALSE;	}		(*rsc)->fns = &resource_class_functions[(*rsc)->variant];	crm_debug_3("Unpacking resource...");		(*rsc)->parameters = g_hash_table_new_full(		g_str_hash,g_str_equal, g_hash_destroy_str,g_hash_destroy_str);	for(lpc = 0; lpc < DIMOF(rsc_attrs); lpc++) {		value = crm_element_value(xml_obj, rsc_attrs[lpc]);		if(value != NULL) {			add_hash_param(				(*rsc)->parameters, rsc_attrs[lpc], value);		}	}		unpack_instance_attributes(		xml_obj, XML_TAG_ATTR_SETS, NULL, (*rsc)->parameters,		allowed_attrs, DIMOF(allowed_attrs), data_set);	if(defaults != NULL) {		g_hash_table_foreach(defaults, dup_attr, (*rsc)->parameters);	}		(*rsc)->runnable	   = TRUE; 	(*rsc)->provisional	   = TRUE; 	(*rsc)->starting	   = FALSE; 	(*rsc)->stopping	   = FALSE; 	(*rsc)->parent		   = NULL;	(*rsc)->candidate_colors   = NULL;	(*rsc)->rsc_cons	   = NULL; 	(*rsc)->actions            = NULL;	(*rsc)->failed		   = FALSE;	(*rsc)->start_pending	   = FALSE;		(*rsc)->globally_unique    = TRUE;	(*rsc)->role		   = RSC_ROLE_STOPPED;	(*rsc)->next_role	   = RSC_ROLE_UNKNOWN;	(*rsc)->is_managed	   = data_set->is_managed_default;	(*rsc)->recovery_type      = recovery_stop_start;	(*rsc)->stickiness         = data_set->default_resource_stickiness;	value = g_hash_table_lookup((*rsc)->parameters, XML_CIB_ATTR_PRIORITY);	(*rsc)->priority	   = atoi(value?value:"0"); 	(*rsc)->effective_priority = (*rsc)->priority;	value = g_hash_table_lookup((*rsc)->parameters, "notify");	(*rsc)->notify		   = crm_is_true(value); 		value = g_hash_table_lookup((*rsc)->parameters, "is_managed");	if(value != NULL) {		cl_str_to_boolean(value, &((*rsc)->is_managed));	}	if((*rsc)->is_managed == FALSE) {		crm_warn("Resource %s is currently not managed", (*rsc)->id);	} else if(data_set->symmetric_cluster) {		rsc_to_node_t *new_con = rsc2node_new(			"symmetric_default", *rsc, 0, NULL, data_set);		new_con->node_list_rh = node_list_dup(data_set->nodes, FALSE);	}		crm_debug_2("Options for %s", id);	value = g_hash_table_lookup((*rsc)->parameters, "globally_unique");	if(value != NULL) {		cl_str_to_boolean(value, &((*rsc)->globally_unique));	}		value = g_hash_table_lookup((*rsc)->parameters, XML_RSC_ATTR_RESTART);	if(safe_str_eq(value, "restart")) {		(*rsc)->restart_type = pe_restart_restart;		crm_debug_2("\tDependancy restart handling: restart");	} else {		(*rsc)->restart_type = pe_restart_ignore;		crm_debug_2("\tDependancy restart handling: ignore");	}	value = g_hash_table_lookup((*rsc)->parameters, "multiple_active");	if(safe_str_eq(value, "stop_only")) {		(*rsc)->recovery_type = recovery_stop_only;		crm_debug_2("\tMultiple running resource recovery: stop only");	} else if(safe_str_eq(value, "block")) {		(*rsc)->recovery_type = recovery_block;		crm_debug_2("\tMultiple running resource recovery: block");	} else {				(*rsc)->recovery_type = recovery_stop_start;		crm_debug_2("\tMultiple running resource recovery: stop/start");	}	value = g_hash_table_lookup((*rsc)->parameters, "resource_stickiness");	if(value != NULL) {		(*rsc)->stickiness = char2score(value);	}	if((*rsc)->stickiness > 0) {		crm_debug_2("\tPlacement: prefer current location%s",			    value == NULL?" (default)":"");	} else if((*rsc)->stickiness < 0) {		crm_warn("\tPlacement: always move from the current location%s",			 value == NULL?" (default)":"");	} else {		crm_debug_2("\tPlacement: optimal%s",			    value == NULL?" (default)":"");	}		crm_debug_2("\tNotification of start/stop actions: %s",		    (*rsc)->notify?"required":"not required");	/* 	data_set->resources = g_list_append(data_set->resources, (*rsc)); */	(*rsc)->fns->unpack(*rsc, data_set);	return TRUE;}