| 141 | } |
| 142 | |
| 143 | void |
| 144 | dump_node_scores_worker(int level, const char *file, const char *function, int line, |
| 145 | resource_t * rsc, const char *comment, GHashTable * nodes) |
| 146 | { |
| 147 | GHashTable *hash = nodes; |
| 148 | GHashTableIter iter; |
| 149 | node_t *node = NULL; |
| 150 | |
| 151 | if (rsc) { |
| 152 | hash = rsc->allowed_nodes; |
| 153 | } |
| 154 | |
| 155 | if (rsc && is_set(rsc->flags, pe_rsc_orphan)) { |
| 156 | /* Don't show the allocation scores for orphans */ |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | if (level == 0) { |
| 161 | /* For now we want this in sorted order to keep the regression tests happy */ |
| 162 | GListPtr gIter = NULL; |
| 163 | GListPtr list = g_hash_table_get_values(hash); |
| 164 | |
| 165 | list = g_list_sort(list, sort_node_uname); |
| 166 | |
| 167 | gIter = list; |
| 168 | for (; gIter != NULL; gIter = gIter->next) { |
| 169 | node_t *node = (node_t *) gIter->data; |
| 170 | char *score = score2char(node->weight); |
| 171 | |
| 172 | if (rsc) { |
| 173 | printf("%s: %s allocation score on %s: %s\n", |
| 174 | comment, rsc->id, node->details->uname, score); |
| 175 | } else { |
| 176 | printf("%s: %s = %s\n", comment, node->details->uname, score); |
| 177 | } |
| 178 | free(score); |
| 179 | } |
| 180 | |
| 181 | g_list_free(list); |
| 182 | |
| 183 | } else if (hash) { |
| 184 | g_hash_table_iter_init(&iter, hash); |
| 185 | while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { |
| 186 | char *score = score2char(node->weight); |
| 187 | |
| 188 | if (rsc) { |
| 189 | do_crm_log_alias(LOG_TRACE, file, function, line, |
| 190 | "%s: %s allocation score on %s: %s", comment, rsc->id, |
| 191 | node->details->uname, score); |
| 192 | } else { |
| 193 | do_crm_log_alias(LOG_TRACE, file, function, line + 1, "%s: %s = %s", comment, |
| 194 | node->details->uname, score); |
| 195 | } |
| 196 | free(score); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if (rsc && rsc->children) { |
nothing calls this directly
no test coverage detected