65f081
From 2ce5fc46463ff7b9a5a2c68602d8c5b35a7c37d7 Mon Sep 17 00:00:00 2001
65f081
From: Andrew Beekhof <andrew@beekhof.net>
65f081
Date: Tue, 16 Jan 2018 19:05:31 +1100
65f081
Subject: [PATCH 1/2] Bug rhbz#1519812 - Prevent notify actions from causing
65f081
 --wait to hang
65f081
65f081
---
65f081
 tools/crm_resource_runtime.c | 21 ++++++++++++++++-----
65f081
 1 file changed, 16 insertions(+), 5 deletions(-)
65f081
65f081
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
65f081
index 22bdebf..189d1b3 100644
65f081
--- a/tools/crm_resource_runtime.c
65f081
+++ b/tools/crm_resource_runtime.c
65f081
@@ -1343,10 +1343,19 @@ done:
65f081
     return rc;
65f081
 }
65f081
 
65f081
-#define action_is_pending(action) \
65f081
-    ((is_set((action)->flags, pe_action_optional) == FALSE) \
65f081
-    && (is_set((action)->flags, pe_action_runnable) == TRUE) \
65f081
-    && (is_set((action)->flags, pe_action_pseudo) == FALSE))
65f081
+static inline int action_is_pending(action_t *action) 
65f081
+{
65f081
+    if(is_set(action->flags, pe_action_optional)) {
65f081
+        return FALSE;
65f081
+    } else if(is_set(action->flags, pe_action_runnable) == FALSE) {
65f081
+        return FALSE;
65f081
+    } else if(is_set(action->flags, pe_action_pseudo)) {
65f081
+        return FALSE;
65f081
+    } else if(safe_str_eq("notify", action->task)) {
65f081
+        return FALSE;
65f081
+    }
65f081
+    return TRUE;
65f081
+}
65f081
 
65f081
 /*!
65f081
  * \internal
65f081
@@ -1362,7 +1371,9 @@ actions_are_pending(GListPtr actions)
65f081
     GListPtr action;
65f081
 
65f081
     for (action = actions; action != NULL; action = action->next) {
65f081
-        if (action_is_pending((action_t *) action->data)) {
65f081
+        action_t *a = (action_t *)action->data;
65f081
+        if (action_is_pending(a)) {
65f081
+            crm_notice("Waiting for %s (flags=0x%.8x)", a->uuid, a->flags);
65f081
             return TRUE;
65f081
         }
65f081
     }
65f081
-- 
65f081
1.8.3.1
65f081
65f081
65f081
From ef15ea4f687e7f9ba1f8a99548ee1e0bf9d4b50a Mon Sep 17 00:00:00 2001
65f081
From: Andrew Beekhof <andrew@beekhof.net>
65f081
Date: Mon, 22 Jan 2018 21:18:46 +1100
65f081
Subject: [PATCH 2/2] Fix: rhbz#1527072 - Correctly observe colocation
65f081
 constraints with bundles in the Master role
65f081
65f081
---
65f081
 pengine/container.c | 14 +++++++++++---
65f081
 1 file changed, 11 insertions(+), 3 deletions(-)
65f081
65f081
diff --git a/pengine/container.c b/pengine/container.c
65f081
index f5d916c..15d094d 100644
65f081
--- a/pengine/container.c
65f081
+++ b/pengine/container.c
65f081
@@ -486,10 +486,18 @@ container_rsc_colocation_rh(resource_t * rsc_lh, resource_t * rsc, rsc_colocatio
65f081
         } else {
65f081
             node_t *chosen = tuple->docker->fns->location(tuple->docker, NULL, FALSE);
65f081
 
65f081
-            if (chosen != NULL && is_set_recursive(tuple->docker, pe_rsc_block, TRUE) == FALSE) {
65f081
-                pe_rsc_trace(rsc, "Allowing %s: %s %d", constraint->id, chosen->details->uname, chosen->weight);
65f081
-                allocated_rhs = g_list_prepend(allocated_rhs, chosen);
65f081
+            if (chosen == NULL || is_set_recursive(tuple->docker, pe_rsc_block, TRUE)) {
65f081
+                continue;
65f081
+            }
65f081
+            if(constraint->role_rh >= RSC_ROLE_MASTER && tuple->child == NULL) {
65f081
+                continue;
65f081
             }
65f081
+            if(constraint->role_rh >= RSC_ROLE_MASTER && tuple->child->next_role < RSC_ROLE_MASTER) {
65f081
+                continue;
65f081
+            }
65f081
+
65f081
+            pe_rsc_trace(rsc, "Allowing %s: %s %d", constraint->id, chosen->details->uname, chosen->weight);
65f081
+            allocated_rhs = g_list_prepend(allocated_rhs, chosen);
65f081
         }
65f081
     }
65f081
 
65f081
-- 
65f081
1.8.3.1
65f081