| 1213 | } |
| 1214 | |
| 1215 | static void |
| 1216 | process_rsc_state(resource_t * rsc, node_t * node, |
| 1217 | enum action_fail_response on_fail, |
| 1218 | xmlNode * migrate_op, pe_working_set_t * data_set) |
| 1219 | { |
| 1220 | pe_rsc_trace(rsc, "Resource %s is %s on %s: on_fail=%s", |
| 1221 | rsc->id, role2text(rsc->role), node->details->uname, fail2text(on_fail)); |
| 1222 | |
| 1223 | /* process current state */ |
| 1224 | if (rsc->role != RSC_ROLE_UNKNOWN) { |
| 1225 | resource_t *iter = rsc; |
| 1226 | |
| 1227 | while (iter) { |
| 1228 | if (g_hash_table_lookup(iter->known_on, node->details->id) == NULL) { |
| 1229 | node_t *n = node_copy(node); |
| 1230 | |
| 1231 | pe_rsc_trace(rsc, "%s (aka. %s) known on %s", rsc->id, rsc->clone_name, n->details->uname); |
| 1232 | g_hash_table_insert(iter->known_on, (gpointer) n->details->id, n); |
| 1233 | } |
| 1234 | if (is_set(iter->flags, pe_rsc_unique)) { |
| 1235 | break; |
| 1236 | } |
| 1237 | iter = iter->parent; |
| 1238 | } |
| 1239 | } |
| 1240 | |
| 1241 | if (rsc->role > RSC_ROLE_STOPPED |
| 1242 | && node->details->online == FALSE |
| 1243 | && is_set(rsc->flags, pe_rsc_managed) |
| 1244 | && is_set(data_set->flags, pe_flag_stonith_enabled)) { |
| 1245 | char *reason = g_strdup_printf("because %s is thought to be active there", rsc->id); |
| 1246 | pe_fence_node(data_set, node, reason); |
| 1247 | g_free(reason); |
| 1248 | } |
| 1249 | |
| 1250 | if (node->details->unclean) { |
| 1251 | /* No extra processing needed |
| 1252 | * Also allows resources to be started again after a node is shot |
| 1253 | */ |
| 1254 | on_fail = action_fail_ignore; |
| 1255 | } |
| 1256 | |
| 1257 | switch (on_fail) { |
| 1258 | case action_fail_ignore: |
| 1259 | /* nothing to do */ |
| 1260 | break; |
| 1261 | |
| 1262 | case action_fail_fence: |
| 1263 | /* treat it as if it is still running |
| 1264 | * but also mark the node as unclean |
| 1265 | */ |
| 1266 | pe_fence_node(data_set, node, "to recover from resource failure(s)"); |
| 1267 | break; |
| 1268 | |
| 1269 | case action_fail_standby: |
| 1270 | node->details->standby = TRUE; |
| 1271 | node->details->standby_onfail = TRUE; |
| 1272 | break; |
no test coverage detected