Blame SOURCES/pacemaker-fix_pe_correctly_account_for_the_location_preferences_of_things_colocated_with_a_group.patch

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