MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / node_list_exclude

Function node_list_exclude

lib/pengine/utils.c:57–90  ·  view source on GitHub ↗

any node in list1 or list2 and not in the other gets a score of -INFINITY */

Source from the content-addressed store, hash-verified

55
56/* any node in list1 or list2 and not in the other gets a score of -INFINITY */
57void
58node_list_exclude(GHashTable * hash, GListPtr list, gboolean merge_scores)
59{
60 GHashTable *result = hash;
61 node_t *other_node = NULL;
62 GListPtr gIter = list;
63
64 GHashTableIter iter;
65 node_t *node = NULL;
66
67 g_hash_table_iter_init(&iter, hash);
68 while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) {
69
70 other_node = pe_find_node_id(list, node->details->id);
71 if (other_node == NULL) {
72 node->weight = -INFINITY;
73 } else if (merge_scores) {
74 node->weight = merge_weights(node->weight, other_node->weight);
75 }
76 }
77
78 for (; gIter != NULL; gIter = gIter->next) {
79 node_t *node = (node_t *) gIter->data;
80
81 other_node = pe_hash_table_lookup(result, node->details->id);
82
83 if (other_node == NULL) {
84 node_t *new_node = node_copy(node);
85
86 new_node->weight = -INFINITY;
87 g_hash_table_insert(result, (gpointer) new_node->details->id, new_node);
88 }
89 }
90}
91
92GHashTable *
93node_hash_from_list(GListPtr list)

Callers 2

clone_rsc_colocation_rhFunction · 0.85
master_rsc_colocation_rhFunction · 0.85

Calls 6

g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
pe_find_node_idFunction · 0.85
merge_weightsFunction · 0.85
pe_hash_table_lookupFunction · 0.85
node_copyFunction · 0.85

Tested by

no test coverage detected