list->timer_id = Gmain_timeout_add( default_op_timeout,timer_callback,(void*)list);
if(action->timeout > 0) { crm_debug("Setting timer for action %d",action->id); action->timer_id = Gmain_timeout_add( action->timeout, timer_callback, action); }  free_xml(options); #endif return TRUE; } else if(safe_str_eq(action->xml->name, "rsc_op")){ crm_info("Executing rsc-op (%s): %s %s on %s", id, task, xmlGetProp(action->xml->children, XML_ATTR_ID), on_node);   do_update_cib(action->xml, -1);  #ifndef TESTING  data    = create_xml_node(NULL, "msg_data"); rsc_op  = create_xml_node(data, "rsc_op"); options = create_xml_node(NULL, XML_TAG_OPTIONS);  set_xml_property_copy(options, XML_ATTR_OP, "rsc_op");
initiate_action(action_list_t *list) {	gboolean is_optional  = TRUE;	xmlNodePtr xml_action = NULL;	const char *on_node   = NULL;	const char *id        = NULL;	const char *runnable  = NULL;	const char *optional  = NULL;	const char *task      = NULL;	const char *discard   = NULL;	const char *timeout   = NULL;#ifndef TESTING	xmlNodePtr options = NULL;	unsigned   op_timeout = 0;	xmlNodePtr data    = NULL;	xmlNodePtr rsc_op  = NULL;#endif		crm_info("Initiating action on list %d", list->id);	while(TRUE) {				list->index++;		xml_action = g_list_nth_data(list->actions, list->index);				if(xml_action == NULL) {			crm_info("No tasks left on list %d", list->id);			list->status = TE_LIST_COMPLETE;						return TRUE;		}				discard  = xmlGetProp(xml_action, XML_LRM_ATTR_DISCARD);		on_node  = xmlGetProp(xml_action, XML_LRM_ATTR_TARGET);		id       = xmlGetProp(xml_action, XML_ATTR_ID);		runnable = xmlGetProp(xml_action, XML_LRM_ATTR_RUNNABLE);		optional = xmlGetProp(xml_action, XML_LRM_ATTR_OPTIONAL);		task     = xmlGetProp(xml_action, XML_LRM_ATTR_TASK);		timeout  = xmlGetProp(xml_action, "timeout");		if(safe_str_eq(discard, XML_BOOLEAN_TRUE)) {			crm_info("Skipping discarded rsc-op (%s): %s %s on %s",				 id, task,				 xmlGetProp(xml_action->children, XML_ATTR_ID),				 on_node);			continue;		}		if(safe_str_neq(optional, XML_BOOLEAN_TRUE)) {			is_optional = FALSE;		}				list->force = list->force || !is_optional;		crm_verbose("Processing action %s (id=%s) on %s",		       task, id, on_node);				if(list->force && is_optional) {			crm_info("Forcing execution of otherwise optional task"				 " due to a dependancy on a previous action");		}				if(list->force == FALSE && is_optional) {			if(safe_str_eq(xml_action->name, "rsc_op")){				crm_info("Skipping optional rsc-op (%s):"					 " %s %s on %s",					 id, task,					 xmlGetProp(xml_action->children,						    XML_ATTR_ID),				       on_node);			} else {				crm_info("Skipping optional command"					 " %s (id=%s) on %s",					 task, id, on_node);			}					} else if(safe_str_eq(runnable, XML_BOOLEAN_FALSE)) {			crm_err("Terminated transition on un-runnable command:"				" %s (id=%s) on %s",				task, id, on_node);			list->status = TE_LIST_FAILED;			return FALSE;					} else if(id == NULL || strlen(id) == 0			  || on_node == NULL || strlen(on_node) == 0			  || task == NULL || strlen(task) == 0) {			/* error */			crm_err("Failed on corrupted command: %s (id=%s) on %s",				task, id, on_node);						list->status = TE_LIST_FAILED;			return FALSE;					} else if(safe_str_eq(xml_action->name, "pseduo_event")){			if(safe_str_eq(task, "stonith")){				crm_info("Executing %s (%s) of node %s",					 task, id, on_node);/*  translate this into a stonith op by deisgnated node  may need the CIB to determine who is running the stonith resource    for this node  more liekly, have the pengine find and supply that info */			} else {				crm_err("Failed on unsupported %s: "					"%s (id=%s) on %s",					xml_action->name, task, id, on_node);								list->status = TE_LIST_FAILED;				return FALSE;			}								} else if(safe_str_eq(xml_action->name, "crm_event")){			/*			  <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);#ifndef TESTING			options = create_xml_node(				NULL, XML_TAG_OPTIONS);			set_xml_property_copy(options, XML_ATTR_OP, task);			send_ipc_request(				crm_ch, options, NULL, on_node,				CRM_SYSTEM_CRMD,CRM_SYSTEM_TENGINE,NULL,NULL);			list->timer_id = Gmain_timeout_add(				default_op_timeout,timer_callback,(void*)list);						free_xml(options);			return TRUE;#endif					} else if(safe_str_eq(xml_action->name, "rsc_op")){			crm_info("Executing rsc-op (%s): %s %s on %s",				 id, task,				 xmlGetProp(xml_action->children, XML_ATTR_ID),				 on_node);#ifndef TESTING			/*			  <msg_data>			  <rsc_op id="operation number" on_node="" task="">			  <resource>...</resource>			*/			data    = create_xml_node(NULL, "msg_data");			rsc_op  = create_xml_node(data, "rsc_op");			options = create_xml_node(				NULL, XML_TAG_OPTIONS);			if(timeout != NULL) {				op_timeout = (unsigned)atoi(timeout);				crm_debug("Decoded timeout %d from %s",					  op_timeout, timeout);			}					set_xml_property_copy(options, XML_ATTR_OP, "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);						add_node_copy(rsc_op, xml_action->children);			/* let everyone know this was invoked */			do_update_cib(xml_action, -1);			send_ipc_request(crm_ch, options, data,					 on_node, "lrmd", CRM_SYSTEM_TENGINE,					 NULL, NULL);			if(op_timeout > 0) {				crm_debug("Setting timer for list %d",list->id);				list->timer_id = Gmain_timeout_add(					op_timeout,timer_callback,(void*)list);			}						free_xml(options);			free_xml(data);			return TRUE;#endif								} else {			crm_err("Failed on unsupported command type: "				"%s, %s (id=%s) on %s",				xml_action->name, task, id, on_node);			list->status = TE_LIST_FAILED;			return FALSE;		}	}		return FALSE;}