add_node_copy(rsc_op, rsc);
initiate_action(action_t *action) {	gboolean ret = FALSE;	const char *on_node   = NULL;	const char *id        = NULL;	const char *task      = NULL;	const char *timeout   = NULL;	const char *destination = NULL;	const char *msg_task    = XML_GRAPH_TAG_RSC_OP;	crm_data_t *rsc_op  = NULL;	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 */		crm_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){		crm_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, XML_CIB_ATTR_STONITH)){		/*         <args target="node1"/> */		stonith_ops_t * st_op = NULL;		crm_data_t *action_args = find_xml_node(			action->xml, "args", TRUE);		const char *target = crm_element_value(action_args, "target");				crm_malloc(st_op, sizeof(stonith_ops_t));		st_op->optype = RESET;		st_op->timeout = crm_atoi(timeout, "10"); /* one second */		st_op->node_name = crm_strdup(target);#ifdef TESTING		ret = TRUE;#else		if (ST_OK == stonithd_node_fence( st_op )) {			ret = TRUE;		}#endif						} else if(on_node == NULL || strlen(on_node) == 0) {		/* error */		crm_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){		/*		  <crm_msg op=XML_LRM_ATTR_TASK to=XML_RES_ATTR_TARGET>		*/		crm_info("Executing crm-event (%s): %s on %s",			 id, task, on_node);		action->complete = TRUE;		destination = CRM_SYSTEM_CRMD;		msg_task = task;		ret = TRUE;	} else if(action->type == action_type_rsc){#ifdef USE_LIBXML		crm_info("Executing rsc-op (%s): %s %s on %s",			 id, task,			 crm_element_value(action->xml->children, XML_ATTR_ID),			 on_node);#else		abort();#endif		/* let everyone know this was invoked */		do_update_cib(action->xml, -1);		/*		  <msg_data>		  <rsc_op id="operation number" on_node="" task="">		  <resource>...</resource>		*/		rsc_op  = create_xml_node(NULL, XML_GRAPH_TAG_RSC_OP);				set_xml_property_copy(rsc_op, XML_ATTR_ID, id);		set_xml_property_copy(rsc_op, XML_LRM_ATTR_TASK, task);		set_xml_property_copy(rsc_op, XML_LRM_ATTR_TARGET, on_node);#ifdef USE_LIBXML		add_node_copy(rsc_op, action->xml->children);#else		abort();#endif		destination = CRM_SYSTEM_LRMD;		ret = TRUE;				} else {		crm_err("Failed on unsupported command type: "			"%s, %s (id=%s) on %s",			crm_element_name(action->xml), task, id, on_node);	}	if(ret) {		HA_Message *cmd = NULL;		char *counter = crm_itoa(transition_counter);		if(rsc_op != NULL) {			crm_xml_debug(rsc_op, "Performing");		}		cmd = create_request(msg_task, rsc_op, on_node, destination,				     CRM_SYSTEM_TENGINE, NULL);		ha_msg_add(cmd, "transition_id", crm_str(counter));#ifndef TESTING		send_ipc_message(crm_ch, cmd);#else		cl_log_message(LOG_DEBUG, cmd);#endif		crm_free(counter);		if(action->timeout > 0) {			crm_debug("Setting timer for action %d",action->id);			start_te_timer(action->timer);		}	}	free_xml(rsc_op);	return ret;}