File bsc#1198767-0001-Test-cts-scheduler-add-regression-test-about-a-pendi.patch of Package pacemaker.29727

From 834c252b223f23ae9ed8e147255c879697bdd0c1 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Tue, 21 Feb 2023 16:48:24 +0100
Subject: [PATCH 1/3] Test: cts-scheduler: add regression test about a pending
 node that doesn't have an uname in node state yet

---
 cts/cts-scheduler.in                          |  1 +
 cts/scheduler/dot/pending-node-no-uname.dot   |  7 ++++
 cts/scheduler/exp/pending-node-no-uname.exp   | 38 +++++++++++++++++++
 .../scores/pending-node-no-uname.scores       |  3 ++
 .../summary/pending-node-no-uname.summary     | 26 +++++++++++++
 cts/scheduler/xml/pending-node-no-uname.xml   | 26 +++++++++++++
 6 files changed, 101 insertions(+)
 create mode 100644 cts/scheduler/dot/pending-node-no-uname.dot
 create mode 100644 cts/scheduler/exp/pending-node-no-uname.exp
 create mode 100644 cts/scheduler/scores/pending-node-no-uname.scores
 create mode 100644 cts/scheduler/summary/pending-node-no-uname.summary
 create mode 100644 cts/scheduler/xml/pending-node-no-uname.xml

diff --git a/cts/cts-scheduler.in b/cts/cts-scheduler.in
index ee0cb7b47..fef732da6 100644
--- a/cts/cts-scheduler.in
+++ b/cts/cts-scheduler.in
@@ -715,6 +715,7 @@ TESTS = [
           "cl#5301 - respect order constraints when relevant resources are being probed" ],
         [ "concurrent-fencing", "Allow performing fencing operations in parallel" ],
         [ "priority-fencing-delay", "Delay fencing targeting the more significant node" ],
+        [ "pending-node-no-uname", "Do not fence a pending node that doesn't have an uname in node state yet" ],
     ],
     [
         [ "systemhealth1", "System Health ()               #1" ],
diff --git a/cts/scheduler/dot/pending-node-no-uname.dot b/cts/scheduler/dot/pending-node-no-uname.dot
new file mode 100644
index 000000000..c808f7ea0
--- /dev/null
+++ b/cts/scheduler/dot/pending-node-no-uname.dot
@@ -0,0 +1,7 @@
+ digraph "g" {
+"st-sbd_monitor_0 node-1" -> "st-sbd_start_0 node-1" [ style = bold]
+"st-sbd_monitor_0 node-1" [ style=bold color="green" fontcolor="black"]
+"st-sbd_start_0 node-1" [ style=bold color="green" fontcolor="black"]
+"stonith 'reboot' node-2" -> "st-sbd_start_0 node-1" [ style = bold]
+"stonith 'reboot' node-2" [ style=bold color="green" fontcolor="black"]
+}
diff --git a/cts/scheduler/exp/pending-node-no-uname.exp b/cts/scheduler/exp/pending-node-no-uname.exp
new file mode 100644
index 000000000..e8fbe17cb
--- /dev/null
+++ b/cts/scheduler/exp/pending-node-no-uname.exp
@@ -0,0 +1,38 @@
+<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="2" operation="start" operation_key="st-sbd_start_0" on_node="node-1" on_node_uuid="1">
+        <primitive id="st-sbd" class="stonith" type="external/sbd"/>
+        <attributes CRM_meta_on_node="node-1" CRM_meta_on_node_uuid="1" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="1" operation="monitor" operation_key="st-sbd_monitor_0" on_node="node-1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <crm_event id="3" operation="stonith" operation_key="stonith-node-2-reboot" on_node="node-2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="1" operation="monitor" operation_key="st-sbd_monitor_0" on_node="node-1" on_node_uuid="1">
+        <primitive id="st-sbd" class="stonith" type="external/sbd"/>
+        <attributes CRM_meta_on_node="node-1" CRM_meta_on_node_uuid="1" CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <crm_event id="3" operation="stonith" operation_key="stonith-node-2-reboot" on_node="node-2" on_node_uuid="2">
+        <attributes CRM_meta_on_node="node-2" CRM_meta_on_node_uuid="2" CRM_meta_stonith_action="reboot" />
+        <downed>
+          <node id="2"/>
+        </downed>
+      </crm_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+</transition_graph>
diff --git a/cts/scheduler/scores/pending-node-no-uname.scores b/cts/scheduler/scores/pending-node-no-uname.scores
new file mode 100644
index 000000000..90a7c8bd4
--- /dev/null
+++ b/cts/scheduler/scores/pending-node-no-uname.scores
@@ -0,0 +1,3 @@
+
+pcmk__native_allocate: st-sbd allocation score on node-1: 0
+pcmk__native_allocate: st-sbd allocation score on node-2: 0
diff --git a/cts/scheduler/summary/pending-node-no-uname.summary b/cts/scheduler/summary/pending-node-no-uname.summary
new file mode 100644
index 000000000..93ac7d48d
--- /dev/null
+++ b/cts/scheduler/summary/pending-node-no-uname.summary
@@ -0,0 +1,26 @@
+Using the original execution date of: 2023-02-21 12:19:57Z
+Current cluster status:
+  * Node List:
+    * Node node-2: UNCLEAN (offline)
+    * Online: [ node-1 ]
+
+  * Full List of Resources:
+    * st-sbd	(stonith:external/sbd):	 Stopped
+
+Transition Summary:
+  * Fence (reboot) node-2 'node is unclean'
+  * Start      st-sbd     ( node-1 )
+
+Executing Cluster Transition:
+  * Resource action: st-sbd          monitor on node-1
+  * Fencing node-2 (reboot)
+  * Resource action: st-sbd          start on node-1
+Using the original execution date of: 2023-02-21 12:19:57Z
+
+Revised Cluster Status:
+  * Node List:
+    * Online: [ node-1 ]
+    * OFFLINE: [ node-2 ]
+
+  * Full List of Resources:
+    * st-sbd	(stonith:external/sbd):	 Started node-1
diff --git a/cts/scheduler/xml/pending-node-no-uname.xml b/cts/scheduler/xml/pending-node-no-uname.xml
new file mode 100644
index 000000000..d1b366421
--- /dev/null
+++ b/cts/scheduler/xml/pending-node-no-uname.xml
@@ -0,0 +1,26 @@
+<cib crm_feature_set="3.0.4" validate-with="pacemaker-2.10" epoch="5" num_updates="0" admin_epoch="0" cib-last-written="Tue Feb 21 13:19:57 2023" update-origin="node-1" update-client="cibadmin" update-user="root" have-quorum="true" dc-uuid="1" execution-date="1676981997">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="true"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="node-1"/>
+      <node id="2" uname="node-2"/>
+    </nodes>
+    <resources>
+      <primitive id="st-sbd" class="stonith" type="external/sbd"/>
+    </resources>
+    <constraints/>
+  </configuration>
+  <status>
+    <node_state id="1" uname="node-1" in_ccm="true" crmd="online" crm-debug-origin="post_cache_update" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources/>
+      </lrm>
+    </node_state>
+    <node_state id="2" in_ccm="true" crmd="offline" crm-debug-origin="post_cache_update"/>
+  </status>
+</cib>
-- 
2.35.3

openSUSE Build Service is sponsored by