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

Function master_rsc_colocation_rh

pengine/master.c:941–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941void
942master_rsc_colocation_rh(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation_t * constraint)
943{
944 GListPtr gIter = NULL;
945
946 CRM_CHECK(rsc_rh != NULL, return);
947 if (is_set(rsc_rh->flags, pe_rsc_provisional)) {
948 return;
949
950 } else if (constraint->role_rh == RSC_ROLE_UNKNOWN) {
951 pe_rsc_trace(rsc_rh, "Handling %s as a clone colocation", constraint->id);
952 clone_rsc_colocation_rh(rsc_lh, rsc_rh, constraint);
953 return;
954 }
955
956 CRM_CHECK(rsc_lh != NULL, return);
957 CRM_CHECK(rsc_lh->variant == pe_native, return);
958 pe_rsc_trace(rsc_rh, "Processing constraint %s: %d", constraint->id, constraint->score);
959
960 if (constraint->role_rh == RSC_ROLE_UNKNOWN) {
961
962 gIter = rsc_rh->children;
963 for (; gIter != NULL; gIter = gIter->next) {
964 resource_t *child_rsc = (resource_t *) gIter->data;
965
966 child_rsc->cmds->rsc_colocation_rh(rsc_lh, child_rsc, constraint);
967 }
968
969 } else if (is_set(rsc_lh->flags, pe_rsc_provisional)) {
970 GListPtr rhs = NULL;
971
972 gIter = rsc_rh->children;
973 for (; gIter != NULL; gIter = gIter->next) {
974 resource_t *child_rsc = (resource_t *) gIter->data;
975 node_t *chosen = child_rsc->fns->location(child_rsc, NULL, FALSE);
976 enum rsc_role_e next_role = child_rsc->fns->state(child_rsc, FALSE);
977
978 pe_rsc_trace(rsc_rh, "Processing: %s", child_rsc->id);
979 if (chosen != NULL && next_role == constraint->role_rh) {
980 pe_rsc_trace(rsc_rh, "Applying: %s %s %s %d", child_rsc->id,
981 role2text(next_role), chosen->details->uname, constraint->score);
982 if (constraint->score < INFINITY) {
983 node_hash_update_one(rsc_lh->allowed_nodes, chosen,
984 constraint->node_attribute, constraint->score);
985 }
986 rhs = g_list_prepend(rhs, chosen);
987 }
988 }
989
990 /* Only do this if its not a master-master colocation
991 * Doing this unconditionally would prevent the slaves from being started
992 */
993 if (constraint->role_lh != RSC_ROLE_MASTER || constraint->role_rh != RSC_ROLE_MASTER) {
994 if (constraint->score >= INFINITY) {
995 node_list_exclude(rsc_lh->allowed_nodes, rhs, TRUE);
996 }
997 }
998 g_list_free(rhs);

Callers

nothing calls this directly

Calls 7

is_setFunction · 0.85
clone_rsc_colocation_rhFunction · 0.85
role2textFunction · 0.85
node_hash_update_oneFunction · 0.85
node_list_excludeFunction · 0.85
find_compatible_childFunction · 0.85
merge_weightsFunction · 0.85

Tested by

no test coverage detected