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

Function native_color

pengine/native.c:421–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421node_t *
422native_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
423{
424 GListPtr gIter = NULL;
425 int alloc_details = scores_log_level + 1;
426
427 if (rsc->parent && is_not_set(rsc->parent->flags, pe_rsc_allocating)) {
428 /* never allocate children on their own */
429 pe_rsc_debug(rsc, "Escalating allocation of %s to its parent: %s", rsc->id, rsc->parent->id);
430 rsc->parent->cmds->allocate(rsc->parent, prefer, data_set);
431 }
432
433 if (is_not_set(rsc->flags, pe_rsc_provisional)) {
434 return rsc->allocated_to;
435 }
436
437 if (is_set(rsc->flags, pe_rsc_allocating)) {
438 pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
439 return NULL;
440 }
441
442 set_bit(rsc->flags, pe_rsc_allocating);
443 print_resource(alloc_details, "Allocating: ", rsc, FALSE);
444 dump_node_scores(alloc_details, rsc, "Pre-allloc", rsc->allowed_nodes);
445
446 for (gIter = rsc->rsc_cons; gIter != NULL; gIter = gIter->next) {
447 rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
448
449 GHashTable *archive = NULL;
450 resource_t *rsc_rh = constraint->rsc_rh;
451
452 pe_rsc_trace(rsc, "%s: Pre-Processing %s (%s, %d, %s)",
453 rsc->id, constraint->id, rsc_rh->id,
454 constraint->score, role2text(constraint->role_lh));
455 if (constraint->role_lh >= RSC_ROLE_MASTER
456 || (constraint->score < 0 && constraint->score > -INFINITY)) {
457 archive = node_hash_dup(rsc->allowed_nodes);
458 }
459 rsc_rh->cmds->allocate(rsc_rh, NULL, data_set);
460 rsc->cmds->rsc_colocation_lh(rsc, rsc_rh, constraint);
461 if (archive && can_run_any(rsc->allowed_nodes) == FALSE) {
462 pe_rsc_info(rsc, "%s: Rolling back scores from %s", rsc->id, rsc_rh->id);
463 g_hash_table_destroy(rsc->allowed_nodes);
464 rsc->allowed_nodes = archive;
465 archive = NULL;
466 }
467 if (archive) {
468 g_hash_table_destroy(archive);
469 }
470 }
471
472 dump_node_scores(alloc_details, rsc, "Post-coloc", rsc->allowed_nodes);
473
474 for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
475 rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
476
477 rsc->allowed_nodes =
478 constraint->rsc_lh->cmds->merge_weights(constraint->rsc_lh, rsc->id, rsc->allowed_nodes,

Callers

nothing calls this directly

Calls 10

is_not_setFunction · 0.85
is_setFunction · 0.85
print_resourceFunction · 0.85
role2textFunction · 0.85
node_hash_dupFunction · 0.85
can_run_anyFunction · 0.85
rsc_ticket_constraintFunction · 0.85
resource_locationFunction · 0.85
native_assign_nodeFunction · 0.85
native_choose_nodeFunction · 0.85

Tested by

no test coverage detected