| 1007 | } |
| 1008 | |
| 1009 | void |
| 1010 | native_create_actions(resource_t * rsc, pe_working_set_t * data_set) |
| 1011 | { |
| 1012 | action_t *start = NULL; |
| 1013 | node_t *chosen = NULL; |
| 1014 | node_t *current = NULL; |
| 1015 | gboolean need_stop = FALSE; |
| 1016 | |
| 1017 | GListPtr gIter = NULL; |
| 1018 | int num_active_nodes = 0; |
| 1019 | enum rsc_role_e role = RSC_ROLE_UNKNOWN; |
| 1020 | enum rsc_role_e next_role = RSC_ROLE_UNKNOWN; |
| 1021 | |
| 1022 | chosen = rsc->allocated_to; |
| 1023 | if (chosen != NULL && rsc->next_role == RSC_ROLE_UNKNOWN) { |
| 1024 | rsc->next_role = RSC_ROLE_STARTED; |
| 1025 | pe_rsc_trace(rsc, "Fixed next_role: unknown -> %s", role2text(rsc->next_role)); |
| 1026 | |
| 1027 | } else if (rsc->next_role == RSC_ROLE_UNKNOWN) { |
| 1028 | rsc->next_role = RSC_ROLE_STOPPED; |
| 1029 | pe_rsc_trace(rsc, "Fixed next_role: unknown -> %s", role2text(rsc->next_role)); |
| 1030 | } |
| 1031 | |
| 1032 | pe_rsc_trace(rsc, "Processing state transition for %s %p: %s->%s", rsc->id, rsc, |
| 1033 | role2text(rsc->role), role2text(rsc->next_role)); |
| 1034 | |
| 1035 | if(rsc->running_on) { |
| 1036 | current = rsc->running_on->data; |
| 1037 | } |
| 1038 | |
| 1039 | for (gIter = rsc->running_on; gIter != NULL; gIter = gIter->next) { |
| 1040 | /* node_t *n = (node_t *) gIter->data; */ |
| 1041 | |
| 1042 | num_active_nodes++; |
| 1043 | } |
| 1044 | |
| 1045 | get_rsc_attributes(rsc->parameters, rsc, chosen, data_set); |
| 1046 | |
| 1047 | for (gIter = rsc->dangling_migrations; gIter != NULL; gIter = gIter->next) { |
| 1048 | node_t *current = (node_t *) gIter->data; |
| 1049 | |
| 1050 | action_t *stop = stop_action(rsc, current, FALSE); |
| 1051 | |
| 1052 | set_bit(stop->flags, pe_action_dangle); |
| 1053 | pe_rsc_trace(rsc, "Forcing a cleanup of %s on %s", rsc->id, current->details->uname); |
| 1054 | |
| 1055 | if (is_set(data_set->flags, pe_flag_remove_after_stop)) { |
| 1056 | DeleteRsc(rsc, current, FALSE, data_set); |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | if (num_active_nodes > 1) { |
| 1061 | |
| 1062 | if (num_active_nodes == 2 |
| 1063 | && chosen |
| 1064 | && rsc->partial_migration_target |
| 1065 | && (chosen->details == rsc->partial_migration_target->details)) { |
| 1066 | /* Here the chosen node is still the migration target from a partial |
nothing calls this directly
no test coverage detected