| 59 | } |
| 60 | |
| 61 | rsc_to_node_t * |
| 62 | rsc2node_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 | |
| 96 | gboolean |
| 97 | can_run_resources(const node_t * node) |
no test coverage detected