if(safe_str_eq(task, CRMD_ACTION_STOP)) { *failed  = FALSE;
if(is_stop_action) {
unpack_rsc_op(resource_t *rsc, node_t *node, crm_data_t *xml_op,	      gboolean *running, gboolean *failed, int *max_call_id,	      pe_working_set_t *data_set) {	const char *task        = NULL; 	const char *task_id     = NULL;	const char *task_status = NULL;	int task_status_i = -2;	int task_id_i = -1;	CRM_DEV_ASSERT(rsc    != NULL); if(crm_assert_failed) { return FALSE; }	CRM_DEV_ASSERT(node   != NULL); if(crm_assert_failed) { return FALSE; }	CRM_DEV_ASSERT(xml_op != NULL); if(crm_assert_failed) { return FALSE; }		task        = crm_element_value(xml_op, XML_LRM_ATTR_TASK); 	task_id     = crm_element_value(xml_op, XML_LRM_ATTR_CALLID);	task_status = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS);	CRM_DEV_ASSERT(task != NULL);        if(crm_assert_failed) { return FALSE; }	CRM_DEV_ASSERT(task_status != NULL);	if(crm_assert_failed) { return FALSE; }	task_status_i = atoi(task_status);	CRM_DEV_ASSERT(task_status_i <= LRM_OP_ERROR);	if(crm_assert_failed) {return FALSE;}	CRM_DEV_ASSERT(task_status_i >= LRM_OP_PENDING);	if(crm_assert_failed) {return FALSE;}	if(task_status_i != LRM_OP_PENDING) {		task_id_i = crm_atoi(task_id, "-1");		CRM_DEV_ASSERT(task_id != NULL);		if(crm_assert_failed) { return FALSE; }		CRM_DEV_ASSERT(task_id_i >= 0);		if(crm_assert_failed) { return FALSE; }		if(task_id_i == *max_call_id) {			crm_debug_2("Already processed this call");			return TRUE;		}		CRM_DEV_ASSERT(task_id_i > *max_call_id);		if(crm_assert_failed) { return FALSE; }	}	if(*max_call_id < task_id_i) {		*max_call_id = task_id_i;	}		if(node->details->unclean) {		crm_debug_2("Node %s (where %s is running) is unclean."			  " Further action depends on the value of %s",			  node->details->uname, rsc->id, XML_RSC_ATTR_STOPFAIL);	}	switch(task_status_i) {		case LRM_OP_PENDING:			/*			 * TODO: this may need some more thought			 * Some cases:			 * - PE reinvoked with pending action that will succeed			 * - PE reinvoked with pending action that will fail			 * - After DC election			 * - After startup			 *			 * pending start - required start			 * pending stop  - required stop			 * pending <any> on unavailable node - stonith			 *			 * For now this should do			 */			if(safe_str_eq(task, CRMD_ACTION_STOP)) {				/* re-issue the stop and return */				stop_action(rsc, node);				*running = TRUE;				rsc->recover = TRUE;							} else if(safe_str_eq(task, CRMD_ACTION_START)) {				rsc->start_pending = TRUE;				*running = TRUE;						/* make sure it is re-issued but,				 * only if we have quorum				 */				if(data_set->have_quorum == TRUE				   || data_set->no_quorum_policy == no_quorum_ignore){					/* do not specify the node, we may want					 * to start it elsewhere					 */					start_action(rsc, NULL);				}							} else if(*running == TRUE) {				crm_debug_4("Re-issuing pending recurring task:"					  " %s for %s on %s",					  task, rsc->id, node->details->id);			}			break;				case LRM_OP_DONE:			crm_debug_3("%s/%s completed on %s",				    rsc->id, task, node->details->uname);			if(safe_str_eq(task, CRMD_ACTION_STOP)) {				*failed  = FALSE;				*running = FALSE;							} else if(safe_str_eq(task, CRMD_ACTION_START)) {				crm_debug_3("%s active on %s",					    rsc->id, node->details->uname);				*running = TRUE;			} else if(*running) {				/* assume its a recurring action */				action_t *mon = NULL;				const char *id = crm_element_value(					xml_op, XML_ATTR_ID);				CRM_DEV_ASSERT(id != NULL);				if(crm_assert_failed) { break; }				mon = custom_action(rsc, crm_strdup(id),						    task, node, data_set);				if(mon != NULL) {					mon->optional = TRUE;				}			}						break;		case LRM_OP_ERROR:		case LRM_OP_TIMEOUT:		case LRM_OP_NOTSUPPORTED:			if(task_status_i == LRM_OP_NOTSUPPORTED			   || safe_str_eq(task, CRMD_ACTION_STOP)			   || safe_str_eq(task, CRMD_ACTION_START) ) {				pe_warn("Handling failed %s for %s on %s",					 task, rsc->id, node->details->uname);				rsc2node_new("dont_run__failed_stopstart",					     rsc, -INFINITY, FALSE, node,					     data_set);			}			crm_debug_2("Processing last op (%s) for %s on %s",				  task, rsc->id, node->details->uname);			if(safe_str_neq(task, CRMD_ACTION_STOP)) {				*failed = TRUE;								*running = TRUE;							} else if(rsc->stopfail_type == pesf_stonith) {				/* treat it as if it is still running				 * but also mark the node as unclean				 */				rsc->unclean = TRUE;				node->details->unclean = TRUE;				*running = TRUE;							} else if(rsc->stopfail_type == pesf_block) {				/* let this depend on the stop action				 * which will fail but make sure the				 * transition continues...				 */				*running = TRUE;								rsc->unclean = TRUE;			} else { /* pretend the stop completed */				*running = FALSE;			}			break;		case LRM_OP_CANCELLED:			/* do nothing?? */			pe_err("Dont know what to do for cancelled ops yet");			break;	}	return TRUE;}