set_xml_property_copy(xml_op,  "transition_magic", code);
crm_xml_add(xml_op,  "transition_magic", code);
cib_action_update(action_t *action, int status){	char *code = NULL;	crm_data_t *fragment = NULL;	crm_data_t *state    = NULL;	crm_data_t *rsc      = NULL;	crm_data_t *xml_op   = NULL;	char *op_id = NULL;	enum cib_errors rc = cib_ok;	const char *task   = crm_element_value(action->xml, XML_LRM_ATTR_TASK);	const char *rsc_id = crm_element_value(action->xml, XML_LRM_ATTR_RSCID);	const char *target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);	const char *target_uuid =		crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);	int call_options = cib_quorum_override;	if(status == LRM_OP_TIMEOUT) {		if(crm_element_value(action->xml, XML_LRM_ATTR_RSCID) != NULL) {			crm_warn("%s: %s %s on %s timed out",				 crm_element_name(action->xml), task, rsc_id, target);		} else {			crm_warn("%s: %s on %s timed out",				 crm_element_name(action->xml), task, target);		}#ifdef TESTING	/* turn the "pending" notification into a "op completed" notification	 *  when testing... exercises more code this way.	 */	} else if(status == LRM_OP_PENDING) {		status = LRM_OP_DONE;#endif	}	code = crm_itoa(status);	/*  update the CIB<node_state id="hadev">      <lrm>        <lrm_resources>          <lrm_resource id="rsc2" last_op="start" op_code="0" target="hadev"/>*/	fragment = NULL;	state    = create_xml_node(NULL, XML_CIB_TAG_STATE);	set_xml_property_copy(state, XML_ATTR_UUID,  target_uuid);	set_xml_property_copy(state, XML_ATTR_UNAME, target);		rsc = create_xml_node(state, XML_CIB_TAG_LRM);	rsc = create_xml_node(rsc,   XML_LRM_TAG_RESOURCES);	rsc = create_xml_node(rsc,   XML_LRM_TAG_RESOURCE);	xml_op = create_xml_node(rsc,XML_LRM_TAG_RSC_OP);		set_xml_property_copy(rsc,    XML_ATTR_ID, rsc_id);	set_xml_property_copy(xml_op, XML_ATTR_ID, task);		op_id = generate_op_key(rsc_id, task, action->interval);	set_xml_property_copy(xml_op, XML_ATTR_ID, op_id);	crm_free(op_id);		set_xml_property_copy(xml_op, XML_LRM_ATTR_TASK, task);	set_xml_property_copy(rsc, XML_LRM_ATTR_RSCSTATE,			      get_rsc_state(task, status));		set_xml_property_copy(rsc, XML_LRM_ATTR_OPSTATUS, code);	set_xml_property_copy(rsc, XML_LRM_ATTR_RC, code);	set_xml_property_copy(rsc, XML_LRM_ATTR_LASTOP, task);		set_xml_property_copy(xml_op, XML_LRM_ATTR_OPSTATUS, code);	set_xml_property_copy(xml_op, XML_LRM_ATTR_RC, code);	set_xml_property_copy(xml_op, "origin", __FUNCTION__);	crm_free(code);	ha_msg_add_int(xml_op, "transition_id", transition_counter);		crm_malloc0(code, sizeof(char)*37);	if(code != NULL) {		snprintf(code, 36, "%d:-1", transition_counter);	}	set_xml_property_copy(xml_op,  "transition_magic", code);	crm_free(code);		set_node_tstamp(xml_op);	fragment = create_cib_fragment(state, NULL);		crm_debug_3("Updating CIB with \"%s\" (%s): %s %s on %s",		  status<0?"new action":XML_ATTR_TIMEOUT,		  crm_element_name(action->xml), crm_str(task), rsc_id, target);	#ifndef TESTING	rc = te_cib_conn->cmds->modify(		te_cib_conn, XML_CIB_TAG_STATUS, fragment, NULL, call_options);	crm_debug("Updating CIB with %s action %d: %s %s on %s (call_id=%d)",		  op_status2text(status), action->id, task, rsc_id, target, rc);	if(status == LRM_OP_PENDING) {		crm_debug_2("Waiting for callback id: %d", rc);		add_cib_op_callback(rc, FALSE, action, cib_action_updated);	}#else	fprintf(stderr, "Initiating action %d: %s %s on %s\n",		action->id, task, rsc_id, target);	call_options = 0;	{		HA_Message *cmd = ha_msg_new(11);		ha_msg_add(cmd, F_TYPE,		T_CRM);		ha_msg_add(cmd, F_CRM_VERSION,	CRM_VERSION);		ha_msg_add(cmd, F_CRM_MSG_TYPE, XML_ATTR_REQUEST);		ha_msg_add(cmd, F_CRM_TASK,	CRM_OP_EVENTCC);		ha_msg_add(cmd, F_CRM_SYS_TO,   CRM_SYSTEM_TENGINE);		ha_msg_add(cmd, F_CRM_SYS_FROM, CRM_SYSTEM_TENGINE);		ha_msg_addstruct(cmd, crm_element_name(state), state);		send_ipc_message(crm_ch, cmd);	}#endif	free_xml(fragment);	free_xml(state);	if(rc < cib_ok) {		return FALSE;	}	return TRUE;}