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

Function rsc2node_new

pengine/utils.c:61–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61rsc_to_node_t *
62rsc2node_new(const char *id, resource_t * rsc,
63 int node_weight, node_t * foo_node, pe_working_set_t * data_set)
64{
65 rsc_to_node_t *new_con = NULL;
66
67 if (rsc == NULL || id == NULL) {
68 pe_err("Invalid constraint %s for rsc=%p", crm_str(id), rsc);
69 return NULL;
70
71 } else if (foo_node == NULL) {
72 CRM_CHECK(node_weight == 0, return NULL);
73 }
74
75 new_con = calloc(1, sizeof(rsc_to_node_t));
76 if (new_con != NULL) {
77 new_con->id = id;
78 new_con->rsc_lh = rsc;
79 new_con->node_list_rh = NULL;
80 new_con->role_filter = RSC_ROLE_UNKNOWN;
81
82 if (foo_node != NULL) {
83 node_t *copy = node_copy(foo_node);
84
85 copy->weight = merge_weights(node_weight, foo_node->weight);
86 new_con->node_list_rh = g_list_prepend(NULL, copy);
87 }
88
89 data_set->placement_constraints = g_list_prepend(data_set->placement_constraints, new_con);
90 rsc->rsc_location = g_list_prepend(rsc->rsc_location, new_con);
91 }
92
93 return new_con;
94}
95
96gboolean
97can_run_resources(const node_t * node)

Callers 3

apply_system_healthFunction · 0.85
unpack_rsc_locationFunction · 0.85
generate_location_ruleFunction · 0.85

Calls 2

node_copyFunction · 0.85
merge_weightsFunction · 0.85

Tested by

no test coverage detected