op->user_data = (void*)crmd_rscstate_START_OK;
op->user_data = crm_strdup(CRMD_RSCSTATE_START_OK);
do_lrm_rsc_op(	lrm_rsc_t *rsc, char *rid, const char *operation, xmlNodePtr msg){	lrm_op_t* op        = NULL;	int op_result       = HA_OK;	int monitor_call_id = 0;	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,			get_xml_attr_nested(				msg, rsc_path, DIMOF(rsc_path) -2,				"class", TRUE),			get_xml_attr_nested(				msg, rsc_path, DIMOF(rsc_path) -2,				XML_ATTR_TYPE, TRUE),			NULL,NULL);				rsc = fsa_lrm_conn->lrm_ops->get_rsc(			fsa_lrm_conn, rid);	}		if(rsc == NULL) {		crm_err("Could not add resource to LRM");		return I_FAIL;	}	/* now do the op */	crm_info("Performing op %s on %s", operation, rid);	op = g_new(lrm_op_t, 1);	op->op_type   = g_strdup(operation);	op->params    = xml2list(msg, rsc_path, DIMOF(rsc_path));	op->timeout   = 0;	op->interval  = 0;	op->user_data = NULL;	op->target_rc = EVERYTIME;	if(safe_str_eq(CRMD_RSCSTATE_START, operation)) {		op->user_data = (void*)crmd_rscstate_START_OK;	} else if(safe_str_eq(CRMD_RSCSTATE_STOP, operation)) {		op->user_data = (void*)crmd_rscstate_STOP_OK;	} else {		crm_warn("Using status \"complete\" for op \"%s\""			 "... this is still in the experimental stage.",			operation);		op->user_data = (void*)crmd_rscstate_GENERIC_OK;	}		op_result = rsc->ops->perform_op(rsc, op);	if(op_result != EXECRA_OK) {		crm_err("Operation %s on %s failed with code: %d",			operation, rid, op_result);		return I_FAIL;	}		if(safe_str_eq(operation, CRMD_RSCSTATE_START)) {		/* initiate the monitor action */		op = g_new(lrm_op_t, 1);		op->op_type   = g_strdup(CRMD_RSCSTATE_MON);		op->params    = NULL;		op->user_data = (void*)crmd_rscstate_MON_OK;		op->timeout   = 0;		op->interval  = 9000;		op->target_rc = CHANGED;		monitor_call_id = rsc->ops->perform_op(rsc, op);		if (monitor_call_id > 0) {			crm_debug("Adding monitor op for %s", rsc->id);			g_hash_table_insert(				monitors, strdup(rsc->id),				GINT_TO_POINTER(monitor_call_id));		} else {			crm_err("Monitor op for %s did not have a call id",				rsc->id);		}			} else if(safe_str_eq(operation, CRMD_RSCSTATE_STOP)) {		gpointer foo = g_hash_table_lookup(monitors, rsc->id);		int monitor_call_id = GPOINTER_TO_INT(foo);				if(monitor_call_id > 0) {			crm_debug("Stopping status op for %s", rsc->id);			rsc->ops->cancel_op(rsc, monitor_call_id);			g_hash_table_remove(monitors, rsc->id);			/* TODO: Clean up key */					} else {			crm_warn("No monitor operation found for %s", rsc->id);		}	}	return I_NULL;}