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

Function clone_color

pengine/clone.c:479–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479node_t *
480clone_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
481{
482 int allocated = 0;
483 GHashTableIter iter;
484 GListPtr gIter = NULL;
485 node_t *node = NULL;
486 int available_nodes = 0;
487 clone_variant_data_t *clone_data = NULL;
488
489 get_clone_variant_data(clone_data, rsc);
490
491 if (is_not_set(rsc->flags, pe_rsc_provisional)) {
492 return NULL;
493
494 } else if (is_set(rsc->flags, pe_rsc_allocating)) {
495 pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
496 return NULL;
497 }
498
499 set_bit(rsc->flags, pe_rsc_allocating);
500 pe_rsc_trace(rsc, "Processing %s", rsc->id);
501
502 /* this information is used by sort_clone_instance() when deciding in which
503 * order to allocate clone instances
504 */
505 gIter = rsc->rsc_cons;
506 for (; gIter != NULL; gIter = gIter->next) {
507 rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
508
509 pe_rsc_trace(rsc, "%s: Coloring %s first", rsc->id, constraint->rsc_rh->id);
510 constraint->rsc_rh->cmds->allocate(constraint->rsc_rh, prefer, data_set);
511 }
512
513 gIter = rsc->rsc_cons_lhs;
514 for (; gIter != NULL; gIter = gIter->next) {
515 rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
516
517 rsc->allowed_nodes =
518 constraint->rsc_lh->cmds->merge_weights(constraint->rsc_lh, rsc->id, rsc->allowed_nodes,
519 constraint->node_attribute,
520 (float) constraint->score / INFINITY,
521 (pe_weights_rollback | pe_weights_positive));
522 }
523
524 gIter = rsc->rsc_tickets;
525 for (; gIter != NULL; gIter = gIter->next) {
526 rsc_ticket_t *rsc_ticket = (rsc_ticket_t *) gIter->data;
527
528 if (rsc_ticket->ticket->granted == FALSE || rsc_ticket->ticket->standby) {
529 rsc_ticket_constraint(rsc, rsc_ticket, data_set);
530 }
531 }
532
533 dump_node_scores(show_scores ? 0 : scores_log_level, rsc, __FUNCTION__, rsc->allowed_nodes);
534
535 /* count now tracks the number of clones currently allocated */
536 g_hash_table_iter_init(&iter, rsc->allowed_nodes);

Callers 1

master_colorFunction · 0.85

Calls 9

is_not_setFunction · 0.85
is_setFunction · 0.85
rsc_ticket_constraintFunction · 0.85
g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
can_run_resourcesFunction · 0.85
color_instanceFunction · 0.85
parent_node_instanceFunction · 0.85
resource_locationFunction · 0.85

Tested by

no test coverage detected