| 1171 | } |
| 1172 | |
| 1173 | static resource_t * |
| 1174 | process_orphan_resource(xmlNode * rsc_entry, node_t * node, pe_working_set_t * data_set) |
| 1175 | { |
| 1176 | resource_t *rsc = NULL; |
| 1177 | const char *rsc_id = crm_element_value(rsc_entry, XML_ATTR_ID); |
| 1178 | |
| 1179 | crm_debug("Detected orphan resource %s on %s", rsc_id, node->details->uname); |
| 1180 | rsc = create_fake_resource(rsc_id, rsc_entry, data_set); |
| 1181 | |
| 1182 | if (is_set(data_set->flags, pe_flag_stop_rsc_orphans) == FALSE) { |
| 1183 | clear_bit(rsc->flags, pe_rsc_managed); |
| 1184 | |
| 1185 | } else { |
| 1186 | GListPtr gIter = NULL; |
| 1187 | |
| 1188 | print_resource(LOG_DEBUG_3, "Added orphan", rsc, FALSE); |
| 1189 | |
| 1190 | CRM_CHECK(rsc != NULL, return NULL); |
| 1191 | resource_location(rsc, NULL, -INFINITY, "__orphan_dont_run__", data_set); |
| 1192 | |
| 1193 | for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { |
| 1194 | node_t *node = (node_t *) gIter->data; |
| 1195 | |
| 1196 | if (node->details->online && get_failcount(node, rsc, NULL, data_set)) { |
| 1197 | action_t *clear_op = NULL; |
| 1198 | action_t *ready = get_pseudo_op(CRM_OP_PROBED, data_set); |
| 1199 | |
| 1200 | clear_op = custom_action(rsc, crm_concat(rsc->id, CRM_OP_CLEAR_FAILCOUNT, '_'), |
| 1201 | CRM_OP_CLEAR_FAILCOUNT, node, FALSE, TRUE, data_set); |
| 1202 | |
| 1203 | add_hash_param(clear_op->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); |
| 1204 | pe_rsc_info(rsc, "Clearing failcount (%d) for orphaned resource %s on %s (%s)", |
| 1205 | get_failcount(node, rsc, NULL, data_set), rsc->id, node->details->uname, |
| 1206 | clear_op->uuid); |
| 1207 | |
| 1208 | order_actions(clear_op, ready, pe_order_optional); |
| 1209 | } |
| 1210 | } |
| 1211 | } |
| 1212 | return rsc; |
| 1213 | } |
| 1214 | |
| 1215 | static void |
| 1216 | process_rsc_state(resource_t * rsc, node_t * node, |
no test coverage detected