commit 5904552658c9ddea0b616375611c3951d1652eac
Author: Gao,Yan <ygao@suse.com>
Date:   Fri Apr 29 15:04:55 2016 +0200

    Test: pengine: Organize order of actions for master resources in anti-colocations

Index: pacemaker/pengine/regression.sh
===================================================================
--- pacemaker.orig/pengine/regression.sh
+++ pacemaker/pengine/regression.sh
@@ -178,6 +178,7 @@ do_test coloc_fp_logic "Verify floating
 do_test colo_master_w_native "cl#5070 - Verify promotion order is affected when colocating master to native rsc."
 do_test colo_slave_w_native  "cl#5070 - Verify promotion order is affected when colocating slave to native rsc."
 do_test anti-colocation-order "cl#5187 - Prevent resources in an anti-colocation from even temporarily running on a same node"
+do_test anti-colocation-master "Organize order of actions for master resources in anti-colocations"
 do_test enforce-colo1 "Always enforce B with A INFINITY."
 do_test complex_enforce_colo "Always enforce B with A INFINITY. (make sure heat-engine stops)"
 
Index: pacemaker/pengine/test10/anti-colocation-master.dot
===================================================================
--- /dev/null
+++ pacemaker/pengine/test10/anti-colocation-master.dot
@@ -0,0 +1,23 @@
+digraph "g" {
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+"dummy1_start_0 sle12sp2-1" [ style=bold color="green" fontcolor="black"]
+"dummy1_stop_0 sle12sp2-2" -> "all_stopped" [ style = bold]
+"dummy1_stop_0 sle12sp2-2" -> "dummy1_start_0 sle12sp2-1" [ style = bold]
+"dummy1_stop_0 sle12sp2-2" -> "ms1_promote_0" [ style = bold]
+"dummy1_stop_0 sle12sp2-2" [ style=bold color="green" fontcolor="black"]
+"ms1_demote_0" -> "ms1_demoted_0" [ style = bold]
+"ms1_demote_0" -> "state1_demote_0 sle12sp2-1" [ style = bold]
+"ms1_demote_0" [ style=bold color="green" fontcolor="orange"]
+"ms1_demoted_0" -> "dummy1_start_0 sle12sp2-1" [ style = bold]
+"ms1_demoted_0" -> "ms1_promote_0" [ style = bold]
+"ms1_demoted_0" [ style=bold color="green" fontcolor="orange"]
+"ms1_promote_0" -> "state1_promote_0 sle12sp2-2" [ style = bold]
+"ms1_promote_0" [ style=bold color="green" fontcolor="orange"]
+"ms1_promoted_0" [ style=bold color="green" fontcolor="orange"]
+"probe_complete sle12sp2-1" [ style=bold color="green" fontcolor="black"]
+"probe_complete sle12sp2-2" [ style=bold color="green" fontcolor="black"]
+"state1_demote_0 sle12sp2-1" -> "ms1_demoted_0" [ style = bold]
+"state1_demote_0 sle12sp2-1" [ style=bold color="green" fontcolor="black"]
+"state1_promote_0 sle12sp2-2" -> "ms1_promoted_0" [ style = bold]
+"state1_promote_0 sle12sp2-2" [ style=bold color="green" fontcolor="black"]
+}
Index: pacemaker/pengine/test10/anti-colocation-master.exp
===================================================================
--- /dev/null
+++ pacemaker/pengine/test10/anti-colocation-master.exp
@@ -0,0 +1,131 @@
+<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="8" operation="start" operation_key="dummy1_start_0" on_node="sle12sp2-1" on_node_uuid="1084783155">
+        <primitive id="dummy1" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="7" operation="stop" operation_key="dummy1_stop_0" on_node="sle12sp2-2" on_node_uuid="1084783156"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="22" operation="demoted" operation_key="ms1_demoted_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="7" operation="stop" operation_key="dummy1_stop_0" on_node="sle12sp2-2" on_node_uuid="1084783156">
+        <primitive id="dummy1" class="ocf" provider="pacemaker" type="Dummy"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="11" operation="promote" operation_key="state1_promote_0" internal_operation_key="state1:0_promote_0" on_node="sle12sp2-2" on_node_uuid="1084783156">
+        <primitive id="state1" long-id="state1:0" class="ocf" provider="pacemaker" type="Stateful"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="19" operation="promote" operation_key="ms1_promote_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="13" operation="demote" operation_key="state1_demote_0" internal_operation_key="state1:1_demote_0" on_node="sle12sp2-1" on_node_uuid="1084783155">
+        <primitive id="state1" long-id="state1:1" class="ocf" provider="pacemaker" type="Stateful"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="21" operation="demote" operation_key="ms1_demote_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="22" operation="demoted" operation_key="ms1_demoted_0">
+        <attributes CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="demote" operation_key="state1_demote_0" internal_operation_key="state1:1_demote_0" on_node="sle12sp2-1" on_node_uuid="1084783155"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="21" operation="demote" operation_key="ms1_demote_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="21" operation="demote" operation_key="ms1_demote_0">
+        <attributes CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="6" priority="1000000">
+    <action_set>
+      <pseudo_event id="20" operation="promoted" operation_key="ms1_promoted_0">
+        <attributes CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="11" operation="promote" operation_key="state1_promote_0" internal_operation_key="state1:0_promote_0" on_node="sle12sp2-2" on_node_uuid="1084783156"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="19" operation="promote" operation_key="ms1_promote_0">
+        <attributes CRM_meta_clone_max="2" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_master_max="1" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="7" operation="stop" operation_key="dummy1_stop_0" on_node="sle12sp2-2" on_node_uuid="1084783156"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="22" operation="demoted" operation_key="ms1_demoted_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8" priority="1000000">
+    <action_set>
+      <rsc_op id="4" operation="probe_complete" operation_key="probe_complete-sle12sp2-2" on_node="sle12sp2-2" on_node_uuid="1084783156">
+        <attributes CRM_meta_op_no_wait="true" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="9" priority="1000000">
+    <action_set>
+      <rsc_op id="3" operation="probe_complete" operation_key="probe_complete-sle12sp2-1" on_node="sle12sp2-1" on_node_uuid="1084783155">
+        <attributes CRM_meta_op_no_wait="true" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <pseudo_event id="1" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="7" operation="stop" operation_key="dummy1_stop_0" on_node="sle12sp2-2" on_node_uuid="1084783156"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
Index: pacemaker/pengine/test10/anti-colocation-master.scores
===================================================================
--- /dev/null
+++ pacemaker/pengine/test10/anti-colocation-master.scores
@@ -0,0 +1,17 @@
+Allocation scores:
+clone_color: ms1 allocation score on sle12sp2-1: 0
+clone_color: ms1 allocation score on sle12sp2-2: 0
+clone_color: state1:0 allocation score on sle12sp2-1: 0
+clone_color: state1:0 allocation score on sle12sp2-2: 6
+clone_color: state1:1 allocation score on sle12sp2-1: 11
+clone_color: state1:1 allocation score on sle12sp2-2: 0
+native_color: dummy1 allocation score on sle12sp2-1: 0
+native_color: dummy1 allocation score on sle12sp2-2: -INFINITY
+native_color: st_sbd allocation score on sle12sp2-1: 0
+native_color: st_sbd allocation score on sle12sp2-2: 0
+native_color: state1:0 allocation score on sle12sp2-1: -INFINITY
+native_color: state1:0 allocation score on sle12sp2-2: 6
+native_color: state1:1 allocation score on sle12sp2-1: 11
+native_color: state1:1 allocation score on sle12sp2-2: 0
+state1:0 promotion score on sle12sp2-2: 5
+state1:1 promotion score on sle12sp2-1: -INFINITY
Index: pacemaker/pengine/test10/anti-colocation-master.summary
===================================================================
--- /dev/null
+++ pacemaker/pengine/test10/anti-colocation-master.summary
@@ -0,0 +1,35 @@
+
+Current cluster status:
+Online: [ sle12sp2-1 sle12sp2-2 ]
+
+ st_sbd	(stonith:external/sbd):	Started sle12sp2-2 
+ dummy1	(ocf::pacemaker:Dummy):	Started sle12sp2-2 
+ Master/Slave Set: ms1 [state1]
+     Masters: [ sle12sp2-1 ]
+     Slaves: [ sle12sp2-2 ]
+
+Transition Summary:
+ * Move    dummy1	(Started sle12sp2-2 -> sle12sp2-1)
+ * Promote state1:0	(Slave -> Master sle12sp2-2)
+ * Demote  state1:1	(Master -> Slave sle12sp2-1)
+
+Executing cluster transition:
+ * Resource action: dummy1          stop on sle12sp2-2
+ * Pseudo action:   ms1_demote_0
+ * Pseudo action:   all_stopped
+ * Resource action: state1          demote on sle12sp2-1
+ * Pseudo action:   ms1_demoted_0
+ * Pseudo action:   ms1_promote_0
+ * Resource action: dummy1          start on sle12sp2-1
+ * Resource action: state1          promote on sle12sp2-2
+ * Pseudo action:   ms1_promoted_0
+
+Revised cluster status:
+Online: [ sle12sp2-1 sle12sp2-2 ]
+
+ st_sbd	(stonith:external/sbd):	Started sle12sp2-2 
+ dummy1	(ocf::pacemaker:Dummy):	Started sle12sp2-1 
+ Master/Slave Set: ms1 [state1]
+     Masters: [ sle12sp2-2 ]
+     Slaves: [ sle12sp2-1 ]
+
Index: pacemaker/pengine/test10/anti-colocation-master.xml
===================================================================
--- /dev/null
+++ pacemaker/pengine/test10/anti-colocation-master.xml
@@ -0,0 +1,74 @@
+<cib crm_feature_set="3.0.8" validate-with="pacemaker-1.2" epoch="232" num_updates="0" admin_epoch="0" cib-last-written="Fri Apr 29 11:06:59 2016" update-origin="sle12sp2-1" update-client="crm_resource" update-user="root" have-quorum="1" dc-uuid="1084783156">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair name="dc-version" value="1.1.14-18.4-5a6cdd1" id="cib-bootstrap-options-dc-version"/>
+        <nvpair name="cluster-infrastructure" value="corosync" id="cib-bootstrap-options-cluster-infrastructure"/>
+        <nvpair name="last-lrm-refresh" value="1460540775" id="cib-bootstrap-options-last-lrm-refresh"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1084783155" uname="sle12sp2-1"/>
+      <node id="1084783156" uname="sle12sp2-2"/>
+    </nodes>
+    <resources>
+      <primitive id="st_sbd" class="stonith" type="external/sbd"/>
+      <primitive id="dummy1" class="ocf" provider="pacemaker" type="Dummy"/>
+      <master id="ms1">
+        <meta_attributes id="ms1-meta_attributes">
+          <nvpair name="interleave" value="true" id="ms1-meta_attributes-interleave"/>
+        </meta_attributes>
+        <primitive id="state1" class="ocf" provider="pacemaker" type="Stateful"/>
+      </master>
+    </resources>
+    <constraints>
+      <rsc_colocation id="dummy1-nerver-with-ms1-master" score="-INFINITY" rsc="dummy1" rsc-role="Started" with-rsc="ms1" with-rsc-role="Master"/>
+      <rsc_location id="cli-ban-ms1-on-sle12sp2-1" rsc="ms1" role="Master" node="sle12sp2-1" score="-INFINITY"/>
+    </constraints>
+    <rsc_defaults/>
+  </configuration>
+  <status>
+    <node_state id="1084783156" uname="sle12sp2-2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="1084783156">
+        <instance_attributes id="status-1084783156">
+          <nvpair id="status-1084783156-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1084783156-master-state1" name="master-state1" value="5"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1084783156">
+        <lrm_resources>
+          <lrm_resource id="st_sbd" type="external/sbd" class="stonith">
+            <lrm_rsc_op id="st_sbd_last_0" operation_key="st_sbd_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="3:7:0:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:0;3:7:0:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1461774608" last-rc-change="1461774608" exec-time="1394" queue-time="1" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="dummy1" type="Dummy" class="ocf" provider="pacemaker">
+            <lrm_rsc_op id="dummy1_last_0" operation_key="dummy1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="24:184:0:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:0;24:184:0:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-2" call-id="38" rc-code="0" op-status="0" interval="0" last-run="1461920068" last-rc-change="1461920068" exec-time="47" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state  passwd  op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-secure-params=" passwd " op-secure-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="state1" type="Stateful" class="ocf" provider="pacemaker">
+            <lrm_rsc_op id="state1_last_0" operation_key="state1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="32:186:0:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:0;32:186:0:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-2" call-id="39" rc-code="0" op-status="0" interval="0" last-run="1461920305" last-rc-change="1461920305" exec-time="114" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="1084783155" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" uname="sle12sp2-1" join="member" expected="member">
+      <transient_attributes id="1084783155">
+        <instance_attributes id="status-1084783155">
+          <nvpair id="status-1084783155-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1084783155-master-state1" name="master-state1" value="10"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1084783155">
+        <lrm_resources>
+          <lrm_resource id="st_sbd" type="external/sbd" class="stonith">
+            <lrm_rsc_op id="st_sbd_last_0" operation_key="st_sbd_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="2:10:7:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:7;2:10:7:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-1" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1461774707" last-rc-change="1461774707" exec-time="5" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="dummy1" type="Dummy" class="ocf" provider="pacemaker">
+            <lrm_rsc_op id="dummy1_last_0" operation_key="dummy1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="24:182:0:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:0;24:182:0:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-1" call-id="38" rc-code="0" op-status="0" interval="0" last-run="1461920068" last-rc-change="1461920068" exec-time="95" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state  passwd  op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-secure-params=" passwd " op-secure-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="state1" type="Stateful" class="ocf" provider="pacemaker">
+            <lrm_rsc_op id="state1_last_0" operation_key="state1_promote_0" operation="promote" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="29:184:0:227c6da2-2be2-434b-933b-d715c60f45cd" transition-magic="0:0;29:184:0:227c6da2-2be2-434b-933b-d715c60f45cd" on_node="sle12sp2-1" call-id="39" rc-code="0" op-status="0" interval="0" last-run="1461920068" last-rc-change="1461920068" exec-time="160" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+  </status>
+</cib>
