commit 65c4f3aa4dcda3ac89e29762fe3af51d227b7767
Author: Gao,Yan <ygao@suse.com>
Date:   Tue May 19 18:18:46 2015 +0200

    Test: pengine: cl#5130 - Only check the capacities of the nodes that are allowed to run the resource (regression test)

diff --git a/pengine/regression.sh b/pengine/regression.sh
index a88a084..7b287d0 100755
--- a/pengine/regression.sh
+++ b/pengine/regression.sh
@@ -564,6 +564,8 @@ do_test colocated-utilization-primitive-2 "Colocated Utilization - Choose the mo
 do_test colocated-utilization-group "Colocated Utilization - Group"
 do_test colocated-utilization-clone "Colocated Utilization - Clone"
 
+do_test utilization-check-allowed-nodes "Only check the capacities of the nodes that can run the resource"
+
 echo ""
 do_test reprobe-target_rc "Ensure correct target_rc for reprobe of inactive resources"
 do_test node-maintenance-1 "cl#5128 - Node maintenance"
diff --git a/pengine/test10/utilization-check-allowed-nodes.dot b/pengine/test10/utilization-check-allowed-nodes.dot
new file mode 100644
index 0000000..d09efbc
--- /dev/null
+++ b/pengine/test10/utilization-check-allowed-nodes.dot
@@ -0,0 +1,19 @@
+digraph "g" {
+"load_stopped_node1 node1" [ style=bold color="green" fontcolor="orange"]
+"load_stopped_node2 node2" [ style=bold color="green" fontcolor="orange"]
+"probe_complete node1" -> "probe_complete" [ style = bold]
+"probe_complete node1" [ style=bold color="green" fontcolor="black"]
+"probe_complete node2" -> "probe_complete" [ style = bold]
+"probe_complete node2" [ style=bold color="green" fontcolor="black"]
+"probe_complete" -> "rsc1_start_0 node2" [ style = bold]
+"probe_complete" [ style=bold color="green" fontcolor="orange"]
+"rsc1_monitor_0 node1" -> "probe_complete node1" [ style = bold]
+"rsc1_monitor_0 node1" [ style=bold color="green" fontcolor="black"]
+"rsc1_monitor_0 node2" -> "probe_complete node2" [ style = bold]
+"rsc1_monitor_0 node2" [ style=bold color="green" fontcolor="black"]
+"rsc1_start_0 node2" [ style=bold color="green" fontcolor="black"]
+"rsc2_monitor_0 node1" -> "probe_complete node1" [ style = bold]
+"rsc2_monitor_0 node1" [ style=bold color="green" fontcolor="black"]
+"rsc2_monitor_0 node2" -> "probe_complete node2" [ style = bold]
+"rsc2_monitor_0 node2" [ style=bold color="green" fontcolor="black"]
+}
diff --git a/pengine/test10/utilization-check-allowed-nodes.exp b/pengine/test10/utilization-check-allowed-nodes.exp
new file mode 100644
index 0000000..134ccb3
--- /dev/null
+++ b/pengine/test10/utilization-check-allowed-nodes.exp
@@ -0,0 +1,112 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="11" operation="start" operation_key="rsc1_start_0" on_node="node2" on_node_uuid="node2">
+        <primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="4" operation="probe_complete" operation_key="probe_complete"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="9" operation="monitor" operation_key="rsc1_monitor_0" on_node="node2" on_node_uuid="node2">
+        <primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="6" operation="monitor" operation_key="rsc1_monitor_0" on_node="node1" on_node_uuid="node1">
+        <primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="10" operation="monitor" operation_key="rsc2_monitor_0" on_node="node2" on_node_uuid="node2">
+        <primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <rsc_op id="7" operation="monitor" operation_key="rsc2_monitor_0" on_node="node1" on_node_uuid="node1">
+        <primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="5" priority="1000000">
+    <action_set>
+      <rsc_op id="8" operation="probe_complete" operation_key="probe_complete-node2" on_node="node2" on_node_uuid="node2">
+        <attributes CRM_meta_op_no_wait="true" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="9" operation="monitor" operation_key="rsc1_monitor_0" on_node="node2" on_node_uuid="node2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="10" operation="monitor" operation_key="rsc2_monitor_0" on_node="node2" on_node_uuid="node2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6" priority="1000000">
+    <action_set>
+      <rsc_op id="5" operation="probe_complete" operation_key="probe_complete-node1" on_node="node1" on_node_uuid="node1">
+        <attributes CRM_meta_op_no_wait="true" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="6" operation="monitor" operation_key="rsc1_monitor_0" on_node="node1" on_node_uuid="node1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="7" operation="monitor" operation_key="rsc2_monitor_0" on_node="node1" on_node_uuid="node1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="4" operation="probe_complete" operation_key="probe_complete">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="5" operation="probe_complete" operation_key="probe_complete-node1" on_node="node1" on_node_uuid="node1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="8" operation="probe_complete" operation_key="probe_complete-node2" on_node="node2" on_node_uuid="node2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/utilization-check-allowed-nodes.scores b/pengine/test10/utilization-check-allowed-nodes.scores
new file mode 100644
index 0000000..26887e2
--- /dev/null
+++ b/pengine/test10/utilization-check-allowed-nodes.scores
@@ -0,0 +1,5 @@
+Allocation scores:
+native_color: rsc1 allocation score on node1: -INFINITY
+native_color: rsc1 allocation score on node2: 0
+native_color: rsc2 allocation score on node1: -INFINITY
+native_color: rsc2 allocation score on node2: 0
diff --git a/pengine/test10/utilization-check-allowed-nodes.summary b/pengine/test10/utilization-check-allowed-nodes.summary
new file mode 100644
index 0000000..12bf19a
--- /dev/null
+++ b/pengine/test10/utilization-check-allowed-nodes.summary
@@ -0,0 +1,26 @@
+
+Current cluster status:
+Online: [ node1 node2 ]
+
+ rsc1	(ocf::pacemaker:Dummy):	Stopped
+ rsc2	(ocf::pacemaker:Dummy):	Stopped
+
+Transition Summary:
+ * Start   rsc1	(node2)
+
+Executing cluster transition:
+ * Resource action: rsc1            monitor on node2
+ * Resource action: rsc1            monitor on node1
+ * Resource action: rsc2            monitor on node2
+ * Resource action: rsc2            monitor on node1
+ * Pseudo action:   probe_complete
+ * Pseudo action:   load_stopped_node1
+ * Pseudo action:   load_stopped_node2
+ * Resource action: rsc1            start on node2
+
+Revised cluster status:
+Online: [ node1 node2 ]
+
+ rsc1	(ocf::pacemaker:Dummy):	Started node2
+ rsc2	(ocf::pacemaker:Dummy):	Stopped
+
diff --git a/pengine/test10/utilization-check-allowed-nodes.xml b/pengine/test10/utilization-check-allowed-nodes.xml
new file mode 100644
index 0000000..39cf51f
--- /dev/null
+++ b/pengine/test10/utilization-check-allowed-nodes.xml
@@ -0,0 +1,39 @@
+<cib epoch="1" num_updates="36" admin_epoch="0" validate-with="pacemaker-1.2" cib-last-written="Fri Dec  7 15:42:31 2012" have-quorum="1">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
+        <nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="ignore"/>
+        <nvpair id="cib-bootstrap-options-placement-strategy" name="placement-strategy" value="utilization"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="node1" uname="node1">
+        <utilization id="node1-utlization">
+          <nvpair id="node1-utlization-cpu" name="cpu" value="4"/>
+        </utilization>
+      </node>
+      <node id="node2" uname="node2">
+        <utilization id="node2-utlization">
+          <nvpair id="node2-utlization-cpu" name="cpu" value="2"/>
+        </utilization>
+      </node>
+    </nodes>
+    <resources>
+      <primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
+      <primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy">
+        <utilization id="rsc2-utlization">
+          <nvpair id="rsc2-utlization-cpu" name="cpu" value="4"/>
+        </utilization>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="rsc1-location" rsc="rsc1" node="node1" score="-INFINITY"/>
+      <rsc_colocation id="rsc2-with-rsc1" rsc="rsc2" with-rsc="rsc1" score="INFINITY"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="node1" uname="node1" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="crm_simulate"/>
+    <node_state id="node2" uname="node2" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="crm_simulate"/>
+  </status>
+</cib>
