From 520303b90eb707f5b7a9afa9b106e4a38b90f0f9 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Wed, 14 Jul 2021 17:18:44 -0500
Subject: [PATCH 2/3] Test: scheduler: update existing tests for probe
 scheduling change

This is an improvement. Looking at bundle-probe-order-2 for example,
the bundle's first instance has this status to start:

    * Replica[0]
      * galera	(ocf::heartbeat:galera):	 Stopped (unmanaged)
      * galera-bundle-docker-0	(ocf::heartbeat:docker):	 Started centos2 (unmanaged)
      * galera-bundle-0	(ocf::pacemaker:remote):	 Started centos2 (unmanaged)

After the changes, we now schedule recurring monitors for
galera-bundle-docker-0 and galera-bundle-0 on centos2, and a probe of galera:0
on galera-bundle-0, all of which are possible.
---
 cts/scheduler/bundle-probe-order-2.dot    |  3 ++
 cts/scheduler/bundle-probe-order-3.dot    |  1 +
 cts/scheduler/bundle-probe-order-2.exp    | 33 +++++++++++++++++--
 cts/scheduler/bundle-probe-order-3.exp    | 21 ++++++++----
 .../summary/bundle-probe-order-2.summary      |  3 ++
 .../summary/bundle-probe-order-3.summary      |  1 +
 6 files changed, 53 insertions(+), 9 deletions(-)

Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.dot
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-2.dot
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.dot
@@ -1,6 +1,9 @@
 digraph "g" {
+"galera-bundle-0_monitor_30000 centos2" [ style=bold color="green" fontcolor="black"]
+"galera-bundle-docker-0_monitor_60000 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-1_monitor_0 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-2_monitor_0 centos1" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-2_monitor_0 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-2_monitor_0 centos3" [ style=bold color="green" fontcolor="black"]
+"galera:0_monitor_0 galera-bundle-0" [ style=bold color="green" fontcolor="black"]
 }
Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.dot
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-3.dot
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.dot
@@ -2,6 +2,7 @@ digraph "g" {
 "galera-bundle-0_monitor_0 centos1" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-0_monitor_0 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-0_monitor_0 centos3" [ style=bold color="green" fontcolor="black"]
+"galera-bundle-docker-0_monitor_60000 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-1_monitor_0 centos2" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-2_monitor_0 centos1" [ style=bold color="green" fontcolor="black"]
 "galera-bundle-docker-2_monitor_0 centos2" [ style=bold color="green" fontcolor="black"]
Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.exp
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-2.exp
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.exp
@@ -1,6 +1,33 @@
 <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="14" operation="monitor" operation_key="galera:0_monitor_0" on_node="galera-bundle-0" on_node_uuid="galera-bundle-0" router_node="centos2">
+        <primitive id="galera" long-id="galera:0" class="ocf" provider="heartbeat" type="galera"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_container_attribute_target="host" CRM_meta_globally_unique="false" CRM_meta_master_max="3" CRM_meta_master_node_max="1" CRM_meta_notify="false" CRM_meta_on_node="galera-bundle-0" CRM_meta_on_node_uuid="galera-bundle-0" CRM_meta_op_target_rc="7" CRM_meta_physical_host="centos2" CRM_meta_promoted_max="3" CRM_meta_promoted_node_max="1" CRM_meta_timeout="30000" cluster_host_map="centos1:centos1;centos2:centos2;centos3:centos3"  enable_creation="true" wsrep_cluster_address="gcomm://centos1,centos2,centos3"/>
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="16" operation="monitor" operation_key="galera-bundle-docker-0_monitor_60000" on_node="centos2" on_node_uuid="2">
+        <primitive id="galera-bundle-docker-0" class="ocf" provider="heartbeat" type="docker"/>
+        <attributes CRM_meta_interval="60000" CRM_meta_name="monitor" CRM_meta_on_node="centos2" CRM_meta_on_node_uuid="2" CRM_meta_timeout="20000" allow_pull="true"  force_kill="false" image="docker.io/tripleoupstream/centos-binary-mariadb:latest" monitor_cmd="/bin/true" mount_points="/var/log/pacemaker/bundles/galera-bundle-0" reuse="false" run_cmd="/usr/sbin/pacemaker_remoted" run_opts=" --restart=no -e PCMK_stderr=1 --net=host -e PCMK_remote_port=3123 -v /foo:/etc/libqb/force-filesystem-sockets:ro -v /etc/my.cnf.d/galera.cnf:/etc/my.cnf.d/galera.cnf:ro -v /var/lib/mysql:/var/lib/mysql:rw -v /etc/pacemaker/authkey:/etc/pacemaker/authkey -v /var/log/pacemaker/bundles/galera-bundle-0:/var/log --user=root --log-driver=journald "/>
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="18" operation="monitor" operation_key="galera-bundle-0_monitor_30000" on_node="centos2" on_node_uuid="2">
+        <primitive id="galera-bundle-0" class="ocf" provider="pacemaker" type="remote"/>
+        <attributes CRM_meta_container="galera-bundle-docker-0" CRM_meta_interval="30000" CRM_meta_name="monitor" CRM_meta_on_node="centos2" CRM_meta_on_node_uuid="2" CRM_meta_timeout="30000" addr="centos2"  port="3123"/>
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3">
+    <action_set>
       <rsc_op id="7" operation="monitor" operation_key="galera-bundle-docker-1_monitor_0" on_node="centos2" on_node_uuid="2">
         <primitive id="galera-bundle-docker-1" class="ocf" provider="heartbeat" type="docker"/>
         <attributes CRM_meta_on_node="centos2" CRM_meta_on_node_uuid="2" CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" allow_pull="true"  force_kill="false" image="docker.io/tripleoupstream/centos-binary-mariadb:latest" monitor_cmd="/bin/true" mount_points="/var/log/pacemaker/bundles/galera-bundle-1" reuse="false" run_cmd="/usr/sbin/pacemaker_remoted" run_opts=" --restart=no -e PCMK_stderr=1 --net=host -e PCMK_remote_port=3123 -v /foo:/etc/libqb/force-filesystem-sockets:ro -v /etc/my.cnf.d/galera.cnf:/etc/my.cnf.d/galera.cnf:ro -v /var/lib/mysql:/var/lib/mysql:rw -v /etc/pacemaker/authkey:/etc/pacemaker/authkey -v /var/log/pacemaker/bundles/galera-bundle-1:/var/log --user=root --log-driver=journald "/>
@@ -8,7 +35,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="1">
+  <synapse id="4">
     <action_set>
       <rsc_op id="12" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos3" on_node_uuid="3">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
@@ -17,7 +44,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="2">
+  <synapse id="5">
     <action_set>
       <rsc_op id="9" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos2" on_node_uuid="2">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
@@ -26,7 +53,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="3">
+  <synapse id="6">
     <action_set>
       <rsc_op id="5" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos1" on_node_uuid="1">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.exp
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-3.exp
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.exp
@@ -1,6 +1,15 @@
 <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="16" operation="monitor" operation_key="galera-bundle-docker-0_monitor_60000" on_node="centos2" on_node_uuid="2">
+        <primitive id="galera-bundle-docker-0" class="ocf" provider="heartbeat" type="docker"/>
+        <attributes CRM_meta_interval="60000" CRM_meta_name="monitor" CRM_meta_on_node="centos2" CRM_meta_on_node_uuid="2" CRM_meta_timeout="20000" allow_pull="true"  force_kill="false" image="docker.io/tripleoupstream/centos-binary-mariadb:latest" monitor_cmd="/bin/true" mount_points="/var/log/pacemaker/bundles/galera-bundle-0" reuse="false" run_cmd="/usr/sbin/pacemaker_remoted" run_opts=" --restart=no -e PCMK_stderr=1 --net=host -e PCMK_remote_port=3123 -v /foo:/etc/libqb/force-filesystem-sockets:ro -v /etc/my.cnf.d/galera.cnf:/etc/my.cnf.d/galera.cnf:ro -v /var/lib/mysql:/var/lib/mysql:rw -v /etc/pacemaker/authkey:/etc/pacemaker/authkey -v /var/log/pacemaker/bundles/galera-bundle-0:/var/log --user=root --log-driver=journald "/>
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="1">
+    <action_set>
       <rsc_op id="11" operation="monitor" operation_key="galera-bundle-0_monitor_0" on_node="centos3" on_node_uuid="3">
         <primitive id="galera-bundle-0" class="ocf" provider="pacemaker" type="remote"/>
         <attributes CRM_meta_container="galera-bundle-docker-0" CRM_meta_on_node="centos3" CRM_meta_on_node_uuid="3" CRM_meta_op_target_rc="7" CRM_meta_timeout="30000" addr="centos2"  port="3123"/>
@@ -8,7 +17,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="1">
+  <synapse id="2">
     <action_set>
       <rsc_op id="6" operation="monitor" operation_key="galera-bundle-0_monitor_0" on_node="centos2" on_node_uuid="2">
         <primitive id="galera-bundle-0" class="ocf" provider="pacemaker" type="remote"/>
@@ -17,7 +26,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="2">
+  <synapse id="3">
     <action_set>
       <rsc_op id="3" operation="monitor" operation_key="galera-bundle-0_monitor_0" on_node="centos1" on_node_uuid="1">
         <primitive id="galera-bundle-0" class="ocf" provider="pacemaker" type="remote"/>
@@ -26,7 +35,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="3">
+  <synapse id="4">
     <action_set>
       <rsc_op id="7" operation="monitor" operation_key="galera-bundle-docker-1_monitor_0" on_node="centos2" on_node_uuid="2">
         <primitive id="galera-bundle-docker-1" class="ocf" provider="heartbeat" type="docker"/>
@@ -35,7 +44,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="4">
+  <synapse id="5">
     <action_set>
       <rsc_op id="13" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos3" on_node_uuid="3">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
@@ -44,7 +53,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="5">
+  <synapse id="6">
     <action_set>
       <rsc_op id="9" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos2" on_node_uuid="2">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
@@ -53,7 +62,7 @@
     </action_set>
     <inputs/>
   </synapse>
-  <synapse id="6">
+  <synapse id="7">
     <action_set>
       <rsc_op id="4" operation="monitor" operation_key="galera-bundle-docker-2_monitor_0" on_node="centos1" on_node_uuid="1">
         <primitive id="galera-bundle-docker-2" class="ocf" provider="heartbeat" type="docker"/>
Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.summary
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-2.summary
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-2.summary
@@ -12,6 +12,9 @@ Online: [ centos1 centos2 centos3 ]
 Transition Summary:
 
 Executing cluster transition:
+  * Resource action: galera:0        monitor on galera-bundle-0
+  * Resource action: galera-bundle-docker-0 monitor=60000 on centos2
+  * Resource action: galera-bundle-0 monitor=30000 on centos2
  * Resource action: galera-bundle-docker-1 monitor on centos2
  * Resource action: galera-bundle-docker-2 monitor on centos3
  * Resource action: galera-bundle-docker-2 monitor on centos2
Index: pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.summary
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/cts/scheduler/bundle-probe-order-3.summary
+++ pacemaker-2.0.1+20190417.13d370ca9/cts/scheduler/bundle-probe-order-3.summary
@@ -11,6 +11,7 @@ Online: [ centos1 centos2 centos3 ]
 Transition Summary:
 
 Executing cluster transition:
+  * Resource action: galera-bundle-docker-0 monitor=60000 on centos2
  * Resource action: galera-bundle-0 monitor on centos3
  * Resource action: galera-bundle-0 monitor on centos2
  * Resource action: galera-bundle-0 monitor on centos1
