Blob Blame History Raw
commit 66a3ea6bf9024960736455022c8827a2fbb03bc6
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Fri Aug 2 13:10:58 2013 +1000

    Fix: PE: Do not allow colocation with blocked clone instances

diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h
index 20bb687..a6b9369 100644
--- a/include/crm/pengine/internal.h
+++ b/include/crm/pengine/internal.h
@@ -234,6 +234,7 @@ char *clone_strip(const char *last_rsc_id);
 char *clone_zero(const char *last_rsc_id);
 
 gint sort_node_uname(gconstpointer a, gconstpointer b);
+bool is_set_recursive(resource_t * rsc, long long flag, bool any);
 
 enum rsc_digest_cmp_val {
     /*! Digests are the same */
diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c
index 7bccd65..c6c69e6 100644
--- a/lib/pengine/clone.c
+++ b/lib/pengine/clone.c
@@ -349,7 +349,7 @@ clone_print_xml(resource_t * rsc, const char *pre_text, long options, void *prin
     free(child_text);
 }
 
-static bool is_set_recursive(resource_t * rsc, long long flag, bool any)
+bool is_set_recursive(resource_t * rsc, long long flag, bool any)
 {
     GListPtr gIter;
     bool all = !any;
diff --git a/pengine/clone.c b/pengine/clone.c
index 8f340f4..b15f76f 100644
--- a/pengine/clone.c
+++ b/pengine/clone.c
@@ -925,7 +925,10 @@ find_compatible_child_by_node(resource_t * local_child, node_t * local_node, res
         resource_t *child_rsc = (resource_t *) gIter->data;
         enum rsc_role_e next_role = child_rsc->fns->state(child_rsc, current);
 
-        node = child_rsc->fns->location(child_rsc, NULL, current);
+        if (is_set_recursive(child_rsc, pe_rsc_block, TRUE) == FALSE) {
+            /* We only want instances that haven't failed */
+            node = child_rsc->fns->location(child_rsc, NULL, current);
+        }
 
         if (filter != RSC_ROLE_UNKNOWN && next_role != filter) {
             crm_trace("Filtered %s", child_rsc->id);
@@ -1069,7 +1072,7 @@ clone_rsc_colocation_rh(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation
             resource_t *child_rsc = (resource_t *) gIter->data;
             node_t *chosen = child_rsc->fns->location(child_rsc, NULL, FALSE);
 
-            if (chosen != NULL) {
+            if (chosen != NULL && is_set_recursive(child_rsc, pe_rsc_block, TRUE) == FALSE) {
                 rhs = g_list_prepend(rhs, chosen);
             }
         }