call_options = 0; 
do_update_cib(crm_data_t *xml_action, int status){	char *code;	char since_epoch[64];	crm_data_t *fragment = NULL;	crm_data_t *state    = NULL;	crm_data_t *rsc      = NULL;	enum cib_errors rc = cib_ok;		const char *task   = crm_element_value(xml_action, XML_LRM_ATTR_TASK);	const char *rsc_id = crm_element_value(xml_action, XML_LRM_ATTR_RSCID);	const char *target = crm_element_value(xml_action, XML_LRM_ATTR_TARGET);	const char *target_uuid =		crm_element_value(xml_action, XML_LRM_ATTR_TARGET_UUID);	int call_options = cib_scope_local|cib_discard_reply|cib_sync_call;	call_options |= cib_inhibit_notify;		if(status == LRM_OP_TIMEOUT) {		if(crm_element_value(xml_action, XML_LRM_ATTR_RSCID) != NULL) {			crm_warn("%s: %s %s on %s timed out",				 crm_element_name(xml_action), task, rsc_id, target);		} else {			crm_warn("%s: %s on %s timed out",				 crm_element_name(xml_action), task, target);		}	}	/*  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);#ifdef TESTING	/* turn the "pending" notification into a "op completed" notification	 *  when testing... exercises more code this way.	 */	if(status == -1) {		status = 0;	}#endif	set_xml_property_copy(state,   XML_ATTR_UUID,  target_uuid);	set_xml_property_copy(state,   XML_ATTR_UNAME, target);		if(status != -1 && (safe_str_eq(task, CRM_OP_SHUTDOWN))) {		sprintf(since_epoch, "%ld", (unsigned long)time(NULL));		set_xml_property_copy(rsc, XML_CIB_ATTR_STONITH, since_epoch);			} else {		code = crm_itoa(status);				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);				set_xml_property_copy(rsc, XML_ATTR_ID,         rsc_id);		set_xml_property_copy(rsc, XML_LRM_ATTR_TARGET, target);		set_xml_property_copy(			rsc, XML_LRM_ATTR_TARGET_UUID, target_uuid);		if(safe_str_eq(CRMD_RSCSTATE_START, task)) {			set_xml_property_copy(				rsc, XML_LRM_ATTR_RSCSTATE,				CRMD_RSCSTATE_START_PENDING);		} else if(safe_str_eq(CRMD_RSCSTATE_STOP, task)) {			set_xml_property_copy(				rsc, XML_LRM_ATTR_RSCSTATE,				CRMD_RSCSTATE_STOP_PENDING);		} else {			crm_warn("Using status \"pending\" for op \"%s\"..."				 " this is still in the experimental stage.",				 crm_str(task));			set_xml_property_copy(				rsc, XML_LRM_ATTR_RSCSTATE,				CRMD_RSCSTATE_GENERIC_PENDING);		}				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);		crm_free(code);	}	fragment = create_cib_fragment(state, NULL);		do_crm_log(LOG_DEV, __FUNCTION__, NULL,		   "Updating CIB with \"%s\" (%s): %s %s on %s",		   status<0?"new action":XML_ATTR_TIMEOUT,		   crm_element_name(xml_action), 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);#else	{		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;}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/473b8a509095d733e97b1e794e61fd75c6a8d203/utils.c/buggy/crm/tengine/utils.c