GListPtr child_colors = NULL;
GListPtr child_colorsun = NULL;
clone_color(resource_t *rsc, pe_working_set_t *data_set){	GListPtr color_ptr = NULL;	GListPtr child_colors = NULL;	int local_node_max = 0;	clone_variant_data_t *clone_data = NULL;	get_clone_variant_data(clone_data, rsc);	if(clone_data->self->provisional == FALSE) {		return NULL;	}	local_node_max = clone_data->clone_node_max; 	/* give already allocated resources every chance to run on the node	 *   specified.  other resources can be moved/started where we want	 *   as required	 */	clone_data->child_list = g_list_sort( 		clone_data->child_list, sort_rsc_provisional);	crm_debug("Coloring children of: %s", rsc->id);		if(rsc->stickiness <= 0) {		while(local_node_max > 1		      && clone_data->max_nodes * (local_node_max -1)		      >= clone_data->clone_max) {						local_node_max--;			crm_debug("Dropped the effective value of"				  " clone_node_max to: %d",				  local_node_max);		}	}	clone_data->self->allowed_nodes = g_list_sort(		clone_data->self->allowed_nodes, sort_node_weight);		slist_iter(a_node, node_t, clone_data->self->allowed_nodes, lpc,		   color_t *new_color = NULL;		   if(can_run_resources(a_node) == FALSE) {			   crm_debug("Node cant run resources: %s",				     a_node->details->uname);			   continue;		   }		   crm_debug_3("Processing node %s for: %s",			       a_node->details->uname, rsc->id);		   new_color = create_color(data_set, NULL, NULL);		   new_color->details->candidate_nodes = g_list_append(			   NULL, node_copy(a_node));		   slist_iter(child, resource_t, clone_data->child_list, lpc2,			      node_t *current = NULL;			      if(child->provisional == FALSE) {				      CRM_DEV_ASSERT(child->color != NULL);				      current = child->color->details->chosen_node;			      } else if(child->running_on != NULL) {				      current = child->running_on->data;			      }			      			      if(current == NULL) {				      crm_debug("Not active: %s", child->id);				      continue;			      } else if(current->details != a_node->details) {				      crm_debug_2("Wrong node: %s", child->id);				      continue;			      } else if(child->provisional == FALSE) {				      /* make sure it shows up */				      native_assign_color(child, new_color);				      crm_debug("Previously colored: %s",						child->id);				      				      continue;				      			      } else if(g_list_length(child->running_on) != 1) {				      crm_debug("active != 1: %s", child->id);				      				      continue;			      } else if(new_color->details->num_resources					>= local_node_max) {				      crm_warn("Node %s too full for: %s",					       a_node->details->uname,					       child->id);				      continue;			      }			      native_assign_color(child, new_color);			      			   );		   native_assign_color(rsc, new_color);		   child_colors = g_list_append(child_colors, new_color);		);	while(local_node_max > 1	      && clone_data->max_nodes * (local_node_max -1)	      >= clone_data->clone_max) {		local_node_max--;		crm_debug("Dropped the effective value of clone_node_max to: %d",			  local_node_max);	}		/* allocate the rest */	slist_iter(child, resource_t, clone_data->child_list, lpc2,		   if(child->provisional == FALSE) {			   continue;		   }		   crm_debug_2("Processing unalloc'd resource: %s", child->id);		   color_ptr = next_color(			   child_colors, color_ptr, local_node_max);		   if(color_ptr == NULL) {			   native_assign_color(child, data_set->no_color);		   } else {			   native_assign_color(child, color_ptr->data);		   }		);	clone_data->self->provisional = FALSE;	return NULL;}