File pacemaker-libpengine-pe_order_same_node.patch of Package pacemaker.14737

commit f6ffb93edb68fc20d9fb6a1324bc724ecb131617
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Mon Jul 18 14:55:12 2016 -0500

    Feature: libpengine: allow pe_order_same_node option for constraints
    
    With this option, a constraint between two actions applies only if they are
    scheduled on the same node.

diff --git a/include/crm/pengine/status.h b/include/crm/pengine/status.h
index d9f2ca5..94aa832 100644
--- a/include/crm/pengine/status.h
+++ b/include/crm/pengine/status.h
@@ -397,6 +397,7 @@ enum pe_ordering {
     pe_order_restart               = 0x1000,    /* 'then' is runnable if 'first' is optional or runnable */
     pe_order_stonith_stop          = 0x2000,    /* only applies if the action is non-pseudo */
     pe_order_serialize_only        = 0x4000,    /* serialize */
+    pe_order_same_node             = 0x8000,    /* applies only if 'first' and 'then' are on same node */
 
     pe_order_implies_first_printed = 0x10000,   /* Like ..implies_first but only ensures 'first' is printed, not mandatory */
     pe_order_implies_then_printed  = 0x20000,   /* Like ..implies_then but only ensures 'then' is printed, not mandatory */
diff --git a/pengine/graph.c b/pengine/graph.c
index 0b7252d..9bc6731 100644
--- a/pengine/graph.c
+++ b/pengine/graph.c
@@ -509,6 +509,17 @@ update_action(action_t * then)
             }
         }
 
+        /* Disable constraint if it only applies when on same node, but isn't */
+        if (is_set(other->type, pe_order_same_node)
+            && (first_node->details != then_node->details)) {
+
+            crm_trace("Disabled constraint %s on %s -> %s on %s",
+                       other->action->uuid, first_node->details->uname,
+                       then->uuid, then_node->details->uname);
+            other->type = pe_order_none;
+            continue;
+        }
+
         clear_bit(changed, pe_graph_updated_first);
 
         if (first->rsc != then->rsc
openSUSE Build Service is sponsored by