op->target_rc = EVERYTIME;
do_lrm_rsc_op(	lrm_rsc_t *rsc, char *rid, const char *operation, crm_data_t *msg){	lrm_op_t* op        = NULL;	int call_id         = 0;	int action_timeout  = 0;	fsa_data_t *msg_data = NULL;	const char *type = NULL;	const char *class = NULL;	const char *timeout = NULL;	if(rsc != NULL) {		class = rsc->class;		type = rsc->type;			} else if(msg != NULL) {		class = get_xml_attr_nested(			msg, rsc_path, DIMOF(rsc_path) -2, XML_AGENT_ATTR_CLASS, TRUE);				type = get_xml_attr_nested(			msg, rsc_path, DIMOF(rsc_path) -2, XML_ATTR_TYPE, TRUE);				timeout = get_xml_attr_nested(			msg, rsc_path, DIMOF(rsc_path) -2, XML_ATTR_TIMEOUT, FALSE);	}		if(rsc == NULL) {		/* check if its already there */		CRM_DEV_ASSERT(rid != NULL);		rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid);	}	if(rsc == NULL) {		/* add it to the list */		crm_verbose("adding rsc %s before operation", rid);		fsa_lrm_conn->lrm_ops->add_rsc(			fsa_lrm_conn, rid, class, type, NULL, NULL);				rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid);	}		if(rsc == NULL) {		crm_err("Could not add resource %s to LRM", rid);		register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);		return I_NULL;	}	if(timeout) {		action_timeout = atoi(timeout);		if(action_timeout < 0) {			action_timeout = 0;		}	}	/* stop the monitor before stopping the resource */	if(safe_str_eq(operation, CRMD_RSCSTATE_STOP)) {		gpointer foo = g_hash_table_lookup(monitors, rsc->id);		call_id = GPOINTER_TO_INT(foo);				if(call_id > 0) {			crm_debug("Stopping status op for %s", rsc->id);			rsc->ops->cancel_op(rsc, call_id);			g_hash_table_remove(monitors, rsc->id);			/* TODO: Clean up key */					} else {			crm_warn("No monitor operation found for %s", rsc->id);			/* TODO: we probably need to look up the LRM to find it */		}	}	/* now do the op */	crm_info("Performing op %s on %s", operation, rid);	crm_malloc(op, sizeof(lrm_op_t));	op->op_type   = crm_strdup(operation);	op->timeout   = action_timeout;	op->interval  = 0;	op->user_data = NULL;	op->target_rc = EVERYTIME;	if(msg != NULL) {		op->params = xml2list(msg);	} else {		CRM_DEV_ASSERT(safe_str_eq(CRMD_RSCSTATE_STOP, operation));	}			if(safe_str_eq(CRMD_RSCSTATE_START, operation)) {		op->user_data = crm_strdup(CRMD_RSCSTATE_START_OK);			} else if(safe_str_eq(CRMD_RSCSTATE_STOP, operation)) {		op->user_data = crm_strdup(CRMD_RSCSTATE_STOP_OK);			} else {		crm_warn("Using status \"complete\" for op \"%s\""			 "... this is still in the experimental stage.",			operation);		op->user_data = crm_strdup(CRMD_RSCSTATE_GENERIC_OK);	}		op->user_data_len = 1+strlen(op->user_data);	call_id = rsc->ops->perform_op(rsc, op);	free_lrm_op(op);				if(call_id <= 0) {		crm_err("Operation %s on %s failed: %d",			operation, rid, call_id);		register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);		return I_NULL;	}		if(safe_str_eq(operation, CRMD_RSCSTATE_START)) {		/* initiate the monitor action */		crm_malloc(op, sizeof(lrm_op_t));		op->op_type   = crm_strdup(CRMD_RSCSTATE_MON);		op->params    = NULL;		op->user_data = crm_strdup(CRMD_RSCSTATE_MON_OK);		op->timeout   = 0;		op->interval  = 9000;		op->target_rc = CHANGED;		op->user_data_len = 1+strlen(op->user_data);				call_id = rsc->ops->perform_op(rsc, op);		free_lrm_op(op);				if (call_id > 0) {			crm_debug("Adding monitor op for %s", rsc->id);			g_hash_table_insert(				monitors, strdup(rsc->id),				GINT_TO_POINTER(call_id));		} else {			crm_err("Monitor op for %s did not have a call id",				rsc->id);		}			}	return I_NULL;}