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

Function master_color

pengine/master.c:599–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599node_t *
600master_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
601{
602 int promoted = 0;
603 GListPtr gIter = NULL;
604 GListPtr gIter2 = NULL;
605
606 GHashTableIter iter;
607 node_t *node = NULL;
608 node_t *chosen = NULL;
609 node_t *cons_node = NULL;
610 enum rsc_role_e next_role = RSC_ROLE_UNKNOWN;
611
612 clone_variant_data_t *clone_data = NULL;
613
614 get_clone_variant_data(clone_data, rsc);
615
616 if (is_not_set(rsc->flags, pe_rsc_provisional)) {
617 return NULL;
618
619 } else if (is_set(rsc->flags, pe_rsc_allocating)) {
620 pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
621 return NULL;
622 }
623
624 apply_master_prefs(rsc);
625
626 clone_color(rsc, prefer, data_set);
627
628 set_bit(rsc->flags, pe_rsc_allocating);
629
630 /* count now tracks the number of masters allocated */
631 g_hash_table_iter_init(&iter, rsc->allowed_nodes);
632 while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) {
633 node->count = 0;
634 }
635
636 /*
637 * assign priority
638 */
639 gIter = rsc->children;
640 for (; gIter != NULL; gIter = gIter->next) {
641 GListPtr list = NULL;
642 resource_t *child_rsc = (resource_t *) gIter->data;
643
644 pe_rsc_trace(rsc, "Assigning priority for %s: %s", child_rsc->id,
645 role2text(child_rsc->next_role));
646
647 if (child_rsc->fns->state(child_rsc, TRUE) == RSC_ROLE_STARTED) {
648 set_role_slave(child_rsc, TRUE);
649 }
650
651 chosen = child_rsc->fns->location(child_rsc, &list, FALSE);
652 if (g_list_length(list) > 1) {
653 crm_config_err("Cannot promote non-colocated child %s", child_rsc->id);
654 }
655
656 g_list_free(list);

Callers

nothing calls this directly

Calls 13

is_not_setFunction · 0.85
is_setFunction · 0.85
apply_master_prefsFunction · 0.85
clone_colorFunction · 0.85
g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
role2textFunction · 0.85
set_role_slaveFunction · 0.85
master_scoreFunction · 0.85
master_promotion_orderFunction · 0.85
score2charFunction · 0.85
can_be_masterFunction · 0.85

Tested by

no test coverage detected