commit fab09782a337c492c62028a519df25ee316abee2 Author: Andrew Beekhof Date: Wed Aug 7 10:33:04 2013 +1000 Fix: PE: Correctly account for the location preferences of things colocated with a group diff --git a/pengine/group.c b/pengine/group.c index 823ea08..7e8e026 100644 --- a/pengine/group.c +++ b/pengine/group.c @@ -59,8 +59,8 @@ group_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set) g_list_concat(group_data->first_child->rsc_cons, rsc->rsc_cons); rsc->rsc_cons = NULL; - group_data->first_child->rsc_cons_lhs = - g_list_concat(group_data->first_child->rsc_cons_lhs, rsc->rsc_cons_lhs); + group_data->last_child->rsc_cons_lhs = + g_list_concat(group_data->last_child->rsc_cons_lhs, rsc->rsc_cons_lhs); rsc->rsc_cons_lhs = NULL; dump_node_scores(show_scores ? 0 : scores_log_level, rsc, __PRETTY_FUNCTION__, diff --git a/pengine/native.c b/pengine/native.c index ef8ae0f..37f5211 100644 --- a/pengine/native.c +++ b/pengine/native.c @@ -364,6 +364,15 @@ rsc_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, const c } clear_bit(flags, pe_weights_init); + } else if (rsc->variant == pe_group && rsc->children) { + GListPtr iter = rsc->children; + + pe_rsc_trace(rsc, "%s: Combining scores from %d children of %s", rhs, g_list_length(iter), rsc->id); + work = node_hash_dup(nodes); + for(iter = rsc->children; iter->next != NULL; iter = iter->next) { + work = rsc_merge_weights(iter->data, rhs, work, attr, factor, flags); + } + } else { pe_rsc_trace(rsc, "%s: Combining scores from %s", rhs, rsc->id); work = node_hash_dup(nodes); @@ -383,8 +392,22 @@ rsc_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, const c if (is_set(flags, pe_weights_forward)) { gIter = rsc->rsc_cons; + crm_trace("Checking %d additional colocation constraints", g_list_length(gIter)); + + } else if(rsc->variant == pe_group && rsc->children) { + GListPtr last = rsc->children; + + while (last->next != NULL) { + last = last->next; + } + + gIter = ((resource_t*)last->data)->rsc_cons_lhs; + crm_trace("Checking %d additional optional group colocation constraints from %s", + g_list_length(gIter), ((resource_t*)last->data)->id); + } else { gIter = rsc->rsc_cons_lhs; + crm_trace("Checking %d additional optional colocation constraints %s", g_list_length(gIter), rsc->id); } for (; gIter != NULL; gIter = gIter->next) { diff --git a/pengine/test10/clone-anon-failcount.scores b/pengine/test10/clone-anon-failcount.scores index fb98a30..012bfe9 100644 --- a/pengine/test10/clone-anon-failcount.scores +++ b/pengine/test10/clone-anon-failcount.scores @@ -298,7 +298,7 @@ native_color: clnUMdummy01:1 allocation score on srv04: -INFINITY native_color: clnUMdummy02:0 allocation score on srv01: -INFINITY native_color: clnUMdummy02:0 allocation score on srv02: -INFINITY native_color: clnUMdummy02:0 allocation score on srv03: -INFINITY -native_color: clnUMdummy02:0 allocation score on srv04: 100 +native_color: clnUMdummy02:0 allocation score on srv04: 104 native_color: clnUMdummy02:1 allocation score on srv01: -INFINITY native_color: clnUMdummy02:1 allocation score on srv02: -INFINITY native_color: clnUMdummy02:1 allocation score on srv03: -INFINITY