| 1125 | } |
| 1126 | |
| 1127 | void |
| 1128 | resource_location(resource_t * rsc, node_t * node, int score, const char *tag, |
| 1129 | pe_working_set_t * data_set) |
| 1130 | { |
| 1131 | if (node != NULL) { |
| 1132 | resource_node_score(rsc, node, score, tag); |
| 1133 | |
| 1134 | } else if (data_set != NULL) { |
| 1135 | GListPtr gIter = data_set->nodes; |
| 1136 | |
| 1137 | for (; gIter != NULL; gIter = gIter->next) { |
| 1138 | node_t *node = (node_t *) gIter->data; |
| 1139 | |
| 1140 | resource_node_score(rsc, node, score, tag); |
| 1141 | } |
| 1142 | |
| 1143 | } else { |
| 1144 | GHashTableIter iter; |
| 1145 | node_t *node = NULL; |
| 1146 | |
| 1147 | g_hash_table_iter_init(&iter, rsc->allowed_nodes); |
| 1148 | while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { |
| 1149 | resource_node_score(rsc, node, score, tag); |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | if (node == NULL && score == -INFINITY) { |
| 1154 | if (rsc->allocated_to) { |
| 1155 | crm_info("Deallocating %s from %s", rsc->id, rsc->allocated_to->details->uname); |
| 1156 | free(rsc->allocated_to); |
| 1157 | rsc->allocated_to = NULL; |
| 1158 | } |
| 1159 | } |
| 1160 | } |
| 1161 | |
| 1162 | #define sort_return(an_int, why) do { \ |
| 1163 | free(a_uuid); \ |
no test coverage detected