A_LRM_INVOKE */
| 1182 | |
| 1183 | /* A_LRM_INVOKE */ |
| 1184 | void |
| 1185 | do_lrm_invoke(long long action, |
| 1186 | enum crmd_fsa_cause cause, |
| 1187 | enum crmd_fsa_state cur_state, |
| 1188 | enum crmd_fsa_input current_input, fsa_data_t * msg_data) |
| 1189 | { |
| 1190 | gboolean done = FALSE; |
| 1191 | gboolean create_rsc = TRUE; |
| 1192 | const char *crm_op = NULL; |
| 1193 | const char *from_sys = NULL; |
| 1194 | const char *from_host = NULL; |
| 1195 | const char *operation = NULL; |
| 1196 | ha_msg_input_t *input = fsa_typed_data(fsa_dt_ha_msg); |
| 1197 | const char *user_name = NULL; |
| 1198 | |
| 1199 | #if ENABLE_ACL |
| 1200 | user_name = crm_element_value(input->msg, F_CRM_USER); |
| 1201 | crm_trace("LRM command from user '%s'", user_name); |
| 1202 | #endif |
| 1203 | |
| 1204 | crm_op = crm_element_value(input->msg, F_CRM_TASK); |
| 1205 | from_sys = crm_element_value(input->msg, F_CRM_SYS_FROM); |
| 1206 | if (safe_str_neq(from_sys, CRM_SYSTEM_TENGINE)) { |
| 1207 | from_host = crm_element_value(input->msg, F_CRM_HOST_FROM); |
| 1208 | } |
| 1209 | |
| 1210 | crm_trace("LRM command from: %s", from_sys); |
| 1211 | |
| 1212 | if (safe_str_eq(crm_op, CRM_OP_LRM_DELETE)) { |
| 1213 | operation = CRMD_ACTION_DELETE; |
| 1214 | |
| 1215 | } else if (safe_str_eq(operation, CRM_OP_LRM_REFRESH)) { |
| 1216 | crm_op = CRM_OP_LRM_REFRESH; |
| 1217 | |
| 1218 | } else if (safe_str_eq(crm_op, CRM_OP_LRM_FAIL)) { |
| 1219 | rsc_history_t *entry = NULL; |
| 1220 | lrmd_event_data_t *op = NULL; |
| 1221 | lrmd_rsc_info_t *rsc = NULL; |
| 1222 | xmlNode *xml_rsc = find_xml_node(input->xml, XML_CIB_TAG_RESOURCE, TRUE); |
| 1223 | |
| 1224 | CRM_CHECK(xml_rsc != NULL, return); |
| 1225 | |
| 1226 | /* The lrmd can not fail a resource, it does not understand the |
| 1227 | * concept of success or failure in relation to a resource, it simply |
| 1228 | * executes operations and reports the results. We determine what a failure is. |
| 1229 | * Becaues of this, if we want to fail a resource we have to fake what we |
| 1230 | * understand a failure to look like. |
| 1231 | * |
| 1232 | * To do this we create a fake lrmd operation event for the resource |
| 1233 | * we want to fail. We then pass that event to the lrmd client callback |
| 1234 | * so it will be processed as if it actually came from the lrmd. */ |
| 1235 | op = construct_op(input->xml, ID(xml_rsc), "asyncmon"); |
| 1236 | free((char *) op->user_data); |
| 1237 | op->user_data = NULL; |
| 1238 | entry = g_hash_table_lookup(resource_history, op->rsc_id); |
| 1239 | /* Make sure the call id is greater than the last successful operation, |
| 1240 | * otherwise the failure will not result in a possible recovery of the resource |
| 1241 | * as it could appear the failure occurred before the successful start */ |
no test coverage detected