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

Function group_color

pengine/group.c:30–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#include <lib/pengine/variant.h>
29
30node_t *
31group_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
32{
33 node_t *node = NULL;
34 node_t *group_node = NULL;
35 GListPtr gIter = NULL;
36 group_variant_data_t *group_data = NULL;
37
38 get_group_variant_data(group_data, rsc);
39
40 if (is_not_set(rsc->flags, pe_rsc_provisional)) {
41 return rsc->allocated_to;
42 }
43 pe_rsc_trace(rsc, "Processing %s", rsc->id);
44 if (is_set(rsc->flags, pe_rsc_allocating)) {
45 pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
46 return NULL;
47 }
48
49 if (group_data->first_child == NULL) {
50 /* nothign to allocate */
51 clear_bit(rsc->flags, pe_rsc_provisional);
52 return NULL;
53 }
54
55 set_bit(rsc->flags, pe_rsc_allocating);
56 rsc->role = group_data->first_child->role;
57
58 group_data->first_child->rsc_cons =
59 g_list_concat(group_data->first_child->rsc_cons, rsc->rsc_cons);
60 rsc->rsc_cons = NULL;
61
62 group_data->first_child->rsc_cons_lhs =
63 g_list_concat(group_data->first_child->rsc_cons_lhs, rsc->rsc_cons_lhs);
64 rsc->rsc_cons_lhs = NULL;
65
66 gIter = rsc->rsc_tickets;
67 for (; gIter != NULL; gIter = gIter->next) {
68 rsc_ticket_t *rsc_ticket = (rsc_ticket_t *) gIter->data;
69
70 if (rsc_ticket->ticket->granted == FALSE || rsc_ticket->ticket->standby) {
71 rsc_ticket_constraint(rsc, rsc_ticket, data_set);
72 }
73 }
74
75 dump_node_scores(show_scores ? 0 : scores_log_level, rsc, __PRETTY_FUNCTION__,
76 rsc->allowed_nodes);
77
78 gIter = rsc->children;
79 for (; gIter != NULL; gIter = gIter->next) {
80 resource_t *child_rsc = (resource_t *) gIter->data;
81
82 node = child_rsc->cmds->allocate(child_rsc, prefer, data_set);
83 if (group_node == NULL) {
84 group_node = node;
85 }
86 }
87

Callers

nothing calls this directly

Calls 3

is_not_setFunction · 0.85
is_setFunction · 0.85
rsc_ticket_constraintFunction · 0.85

Tested by

no test coverage detected