crm_info("Processing stage 5");
stage5(GListPtr resources){	int lpc = 0;	int lpc2 = 0;	node_t *start_node = NULL;	node_t *stop_node = NULL;	node_t *default_node = NULL;	crm_verbose("filling in the nodes to perform the actions on");	slist_iter(		rsc, resource_t, resources, lpc,		crm_debug_action(print_resource("Processing", rsc, FALSE));				default_node = NULL;		start_node = safe_val4(			NULL, rsc, color, details, chosen_node);		stop_node = safe_val(NULL, rsc, cur_node);		if(stop_node == NULL && start_node == NULL) {			/* it is not and will not run */			default_node = NULL;		} else if(stop_node == NULL) {			/* it is not running yet, all actions must take place			 * on the new node and if they fail, they fail			 */			default_node = start_node;			rsc->start->optional = FALSE;			crm_info("Starting resource %s (%s)",				  safe_val(NULL, rsc, id),				  safe_val3(NULL,start_node,details,uname));		} else if(start_node == NULL) {			/* it is being stopped, all actions must take place			 * on the existing node and if they fail, they fail			 */			default_node = stop_node;			rsc->stop->optional  = FALSE;			rsc->start->runnable = FALSE;			crm_warn("Stop resource %s (%s)",				  safe_val(NULL, rsc, id),				  safe_val3(NULL, stop_node, details,uname));		} else if(safe_str_eq(			   safe_val3(NULL, stop_node, details, uname),			   safe_val3(NULL, start_node, details, uname))) {			/* its not moving so choose either copy */			default_node = start_node;			crm_verbose("No change (possible restart)"				    " for Resource %s (%s)",				    safe_val(NULL, rsc, id),				    safe_val3(					    NULL,default_node,details,uname));					} else {			/* the resource is moving...			 *			 * the action was scheduled based on its current			 * location and or state, actions other than start			 * and stop *must* be run at the existing location			 * (ie. stop_node)			 *			 */			default_node = stop_node;			rsc->stop->optional  = FALSE;			rsc->start->optional = FALSE;						crm_debug("Move resource %s (%s -> %s)",				  safe_val(NULL, rsc, id),				  safe_val3(NULL, stop_node,details,uname),				  safe_val3(NULL, start_node,details,uname));		}						slist_iter(			action, action_t, rsc->actions, lpc2,			switch(action->task) {				case start_rsc:					action->node = start_node;					break;				case stop_rsc:					action->node = stop_node;					break;				default:					action->node = default_node;					break;			}			if(action->node == NULL) {				crm_debug("Marking action %d as unrunnable",					action->id);				action->runnable = FALSE;			}						);		);		return TRUE;}