} else if(safe_str_eq(operation, CRMD_ACTION_DELETE)) { int rc = HA_OK; const char *lastop = g_hash_table_lookup(resources,rid); if(rsc == NULL) { return I_NULL; } crm_info("Removing resource %s from the LRM", rsc->id);  if(safe_str_neq(lastop, CRMD_ACTION_STOP)) { crm_err("Not removing resource %s: lastop=%s", rsc->id, lastop); return I_NULL; }  rc = fsa_lrm_conn->lrm_ops->delete_rsc( fsa_lrm_conn, rid);  if(rc != HA_OK) { crm_err("Failed to remove resource %s", rid); }
do_lrm_invoke(long long action,	      enum crmd_fsa_cause cause,	      enum crmd_fsa_state cur_state,	      enum crmd_fsa_input current_input,	      fsa_data_t *msg_data){	const char *crm_op = NULL;	const char *operation = NULL;	enum crmd_fsa_input next_input = I_NULL;	ha_msg_input_t *input = fsa_typed_data(fsa_dt_ha_msg);			crm_op = cl_get_string(input->msg, F_CRM_TASK);	operation = crm_element_value(input->xml, XML_LRM_ATTR_TASK);		if(crm_op != NULL && safe_str_eq(crm_op, "lrm_query")) {		crm_data_t *data = do_lrm_query(FALSE);		HA_Message *reply = create_reply(input->msg, data);		if(relay_message(reply, TRUE) == FALSE) {			crm_err("Unable to route reply");			crm_log_message(LOG_ERR, reply);			crm_msg_del(reply);		}		free_xml(data);	} else if(safe_str_eq(crm_op, "lrm_delete")) {		char rid[64];		const char *id_from_msg = cl_get_string(			input->msg, XML_LRM_ATTR_RSCID);		int rc = HA_OK;		if(id_from_msg == NULL) {			crm_err("No resource to remove");			return I_NULL;		}				strncpy(rid, id_from_msg, 64);		rid[63] = 0;		rc = fsa_lrm_conn->lrm_ops->delete_rsc(fsa_lrm_conn, rid);		if(rc != HA_OK) {			crm_err("Failed to remove resource %s from local LRM",				rid);		} else {			crm_info("Resource %s removed from local LRM", rid);		}			} else if(operation != NULL) {		char rid[64];		lrm_rsc_t *rsc = NULL;		const char *id_from_cib = NULL;		crm_data_t *xml_rsc = find_xml_node(			input->xml, XML_CIB_TAG_RESOURCE, TRUE);		CRM_DEV_ASSERT(xml_rsc != NULL);		if(crm_assert_failed) {			crm_log_xml_err(input->xml, "Bad resource");			return I_NULL;		}				id_from_cib = crm_element_value(xml_rsc, XML_ATTR_ID);		CRM_DEV_ASSERT(id_from_cib != NULL);		if(crm_assert_failed) {			crm_err("No value for %s in %s.",				XML_ATTR_ID, crm_element_name(xml_rsc));			crm_log_xml_err(input->xml, "Bad command");			return I_NULL;		}				/* only the first 16 chars are used by the LRM */		strncpy(rid, id_from_cib, 64);		rid[63] = 0;				rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid);		if(safe_str_eq(operation, "cancel")) {			cancel_monitor(rsc, crm_element_value(					       xml_rsc, "operation_key"));		} else {			next_input = do_lrm_rsc_op(				rsc, rid, operation, input->xml, input->msg);		}			} else {		crm_err("Operation was neither a lrm_query, nor a rsc op.  %s",			crm_str(crm_op));		register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);	}	return next_input;}