} else { cib_action_update(action, LRM_OP_PENDING);
initiate_action(action_t *action) {	gboolean ret = FALSE;	gboolean send_command = FALSE;	const char *on_node   = NULL;	const char *id        = NULL;	const char *task      = NULL;	const char *timeout   = NULL;	const char *msg_task    = XML_GRAPH_TAG_RSC_OP;	on_node  = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);	id       = crm_element_value(action->xml, XML_ATTR_ID);	task     = crm_element_value(action->xml, XML_LRM_ATTR_TASK);	timeout  = crm_element_value(action->xml, XML_ATTR_TIMEOUT);	if(id == NULL || strlen(id) == 0	   || task == NULL || strlen(task) == 0) {		/* error */		te_log_action(LOG_ERR, "Failed on corrupted command: %s (id=%s) %s",			crm_element_name(action->xml),			crm_str(id), crm_str(task));	} else if(action->type == action_type_pseudo){		te_log_action(LOG_INFO, "Executing pseudo-event (%d): "			 "%s on %s", action->id, task, on_node);				action->complete = TRUE;		process_trigger(action->id);		ret = TRUE;	} else if(action->type == action_type_crm		  && safe_str_eq(task, CRM_OP_FENCE)){				const char *uuid = NULL;		const char *target = NULL;		stonith_ops_t * st_op = NULL;		target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);		uuid = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);		CRM_DEV_ASSERT(target != NULL);		CRM_DEV_ASSERT(uuid != NULL);		te_log_action(LOG_INFO,"Executing fencing operation (%s) on %s",			      id, target);#ifdef TESTING		ret = TRUE;		action->complete = TRUE;		process_trigger(action->id);		return TRUE;#endif		crm_malloc0(st_op, sizeof(stonith_ops_t));		st_op->optype = RESET;		st_op->timeout = transition_idle_timeout / 2;		st_op->node_name = crm_strdup(target);		st_op->node_uuid = crm_strdup(uuid);		if(stonithd_input_IPC_channel() == NULL) {			crm_err("Cannot fence %s - stonith not available",				target);					} else if (ST_OK == stonithd_node_fence( st_op )) {			ret = TRUE;		}			} else if(on_node == NULL || strlen(on_node) == 0) {		/* error */		te_log_action(LOG_ERR,			      "Failed on corrupted command: %s (id=%s) %s on %s",			      crm_element_name(action->xml), crm_str(id),			      crm_str(task), crm_str(on_node));				} else if(action->type == action_type_crm){		te_log_action(LOG_INFO, "Executing crm-event (%s): %s on %s",			      id, task, on_node);#ifdef TESTING		action->complete = TRUE;		process_trigger(action->id);		return TRUE;#endif/* 		action->complete = TRUE; */		msg_task = task;		send_command = TRUE;	} else if(action->type == action_type_rsc){		/* never overwrite stop actions in the CIB with		 *   anything other than completed results		 *		 * Writing pending stops makes it look like the		 *   resource is running again		 */#ifdef TESTING		action->invoked = FALSE;		cib_action_update(action, LRM_OP_DONE);		return TRUE;#endif		action->invoked = FALSE;		if(safe_str_eq(task, CRMD_ACTION_STOP)		   || safe_str_eq(task, CRMD_ACTION_NOTIFY)) {			cib_action_updated(NULL, 0, cib_ok, NULL, action);		} else {			cib_action_update(action, LRM_OP_PENDING);		}		ret = TRUE;	} else {		te_log_action(LOG_ERR,			      "Failed on unsupported command type: "			      "%s, %s (id=%s) on %s",			      crm_element_name(action->xml), task, id, on_node);	}	if(send_command) {		HA_Message *cmd = NULL;		char *counter = crm_itoa(transition_counter);		cmd = create_request(msg_task, NULL, on_node, CRM_SYSTEM_CRMD,				     CRM_SYSTEM_TENGINE, NULL);		counter = generate_transition_key(transition_counter, te_uuid);		crm_xml_add(cmd, XML_ATTR_TRANSITION_KEY, counter);		ret = send_ipc_message(crm_ch, cmd);		crm_free(counter);		if(ret && action->timeout > 0) {			crm_debug_3("Setting timer for action %d",action->id);			action->timer->reason = timeout_action_warn;			start_te_timer(action->timer);		}	}	return ret;}