]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
test behavior of maintenance mode with another shutdown policy
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 19 Apr 2023 16:38:21 +0000 (18:38 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 Apr 2023 12:10:18 +0000 (14:10 +0200)
Encode what happens if a node is in maintenance and gets shutdown
with a shutdown policy other than 'migrate' (= maintenance mode)
active.

Currently it's causing disabling the maintenance mode and also might
make a fence even possible (if not all service got moved already).
This will be addressed in the next commit.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/test/test-crm-maintenance-request4/README [new file with mode: 0644]
src/test/test-crm-maintenance-request4/cmdlist [new file with mode: 0644]
src/test/test-crm-maintenance-request4/datacenter.cfg [new file with mode: 0644]
src/test/test-crm-maintenance-request4/hardware_status [new file with mode: 0644]
src/test/test-crm-maintenance-request4/log.expect [new file with mode: 0644]
src/test/test-crm-maintenance-request4/manager_status [new file with mode: 0644]
src/test/test-crm-maintenance-request4/service_config [new file with mode: 0644]

diff --git a/src/test/test-crm-maintenance-request4/README b/src/test/test-crm-maintenance-request4/README
new file mode 100644 (file)
index 0000000..5721b12
--- /dev/null
@@ -0,0 +1,4 @@
+Test setting the maintenance mode for a node with coniditional maintenance mode
+set, then reboot it and ensure that maintenance mode doesn't get cleared during
+the stop process by enforcing conditional mode even if the node should be
+already in maintenance (i.e., nothing to move) automatically that way.
diff --git a/src/test/test-crm-maintenance-request4/cmdlist b/src/test/test-crm-maintenance-request4/cmdlist
new file mode 100644 (file)
index 0000000..5a2c1ab
--- /dev/null
@@ -0,0 +1,6 @@
+[
+    [ "power node1 on", "power node2 on", "power node3 on"],
+    [ "crm node1 enable-node-maintenance" ],
+    [ "shutdown node1" ],
+    [ "power node1 on" ]
+]
diff --git a/src/test/test-crm-maintenance-request4/datacenter.cfg b/src/test/test-crm-maintenance-request4/datacenter.cfg
new file mode 100644 (file)
index 0000000..98f4465
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "ha": {
+        "shutdown_policy": "conditional"
+    }
+}
diff --git a/src/test/test-crm-maintenance-request4/hardware_status b/src/test/test-crm-maintenance-request4/hardware_status
new file mode 100644 (file)
index 0000000..451beb1
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "node1": { "power": "off", "network": "off" },
+  "node2": { "power": "off", "network": "off" },
+  "node3": { "power": "off", "network": "off" }
+}
diff --git a/src/test/test-crm-maintenance-request4/log.expect b/src/test/test-crm-maintenance-request4/log.expect
new file mode 100644 (file)
index 0000000..1fd2aff
--- /dev/null
@@ -0,0 +1,83 @@
+info      0     hardware: starting simulation
+info     20      cmdlist: execute power node1 on
+info     20    node1/crm: status change startup => wait_for_quorum
+info     20    node1/lrm: status change startup => wait_for_agent_lock
+info     20      cmdlist: execute power node2 on
+info     20    node2/crm: status change startup => wait_for_quorum
+info     20    node2/lrm: status change startup => wait_for_agent_lock
+info     20      cmdlist: execute power node3 on
+info     20    node3/crm: status change startup => wait_for_quorum
+info     20    node3/lrm: status change startup => wait_for_agent_lock
+info     20    node1/crm: got lock 'ha_manager_lock'
+info     20    node1/crm: status change wait_for_quorum => master
+info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
+info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
+info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
+info     20    node1/crm: adding new service 'vm:101' on node 'node1'
+info     20    node1/crm: adding new service 'vm:102' on node 'node2'
+info     20    node1/crm: adding new service 'vm:103' on node 'node3'
+info     20    node1/crm: service 'vm:101': state changed from 'request_start' to 'started'  (node = node1)
+info     20    node1/crm: service 'vm:103': state changed from 'request_start' to 'started'  (node = node3)
+info     21    node1/lrm: got lock 'ha_agent_node1_lock'
+info     21    node1/lrm: status change wait_for_agent_lock => active
+info     21    node1/lrm: starting service vm:101
+info     21    node1/lrm: service status vm:101 started
+info     22    node2/crm: status change wait_for_quorum => slave
+info     23    node2/lrm: got lock 'ha_agent_node2_lock'
+info     23    node2/lrm: status change wait_for_agent_lock => active
+info     24    node3/crm: status change wait_for_quorum => slave
+info     25    node3/lrm: got lock 'ha_agent_node3_lock'
+info     25    node3/lrm: status change wait_for_agent_lock => active
+info     25    node3/lrm: starting service vm:103
+info     25    node3/lrm: service status vm:103 started
+info     40    node1/crm: service 'vm:102': state changed from 'request_stop' to 'stopped'
+info    120      cmdlist: execute crm node1 enable-node-maintenance
+info    121    node1/lrm: status change active => maintenance
+info    140    node1/crm: node 'node1': state changed from 'online' => 'maintenance'
+info    140    node1/crm: migrate service 'vm:101' to node 'node2' (running)
+info    140    node1/crm: service 'vm:101': state changed from 'started' to 'migrate'  (node = node1, target = node2)
+info    141    node1/lrm: service vm:101 - start migrate to node 'node2'
+info    141    node1/lrm: service vm:101 - end migrate to node 'node2'
+info    160    node1/crm: service 'vm:101': state changed from 'migrate' to 'started'  (node = node2)
+info    163    node2/lrm: starting service vm:101
+info    163    node2/lrm: service status vm:101 started
+info    220      cmdlist: execute shutdown node1
+info    220    node1/lrm: got shutdown request with shutdown policy 'conditional'
+info    220    node1/lrm: shutdown LRM, stop all services
+info    220    node1/crm: node 'node1': state changed from 'maintenance' => 'online'
+info    220    node1/crm: moving service 'vm:101' back to 'node1', node came back from maintenance.
+info    220    node1/crm: migrate service 'vm:101' to node 'node1' (running)
+info    220    node1/crm: service 'vm:101': state changed from 'started' to 'migrate'  (node = node2, target = node1)
+info    221    node1/lrm: got lock 'ha_agent_node1_lock'
+info    221    node1/lrm: status change maintenance => active
+info    222    node1/lrm: exit (loop end)
+info    222     shutdown: execute crm node1 stop
+info    221    node1/crm: server received shutdown request
+info    223    node2/lrm: service vm:101 - start migrate to node 'node1'
+info    223    node2/lrm: service vm:101 - end migrate to node 'node1'
+info    240    node1/crm: voluntary release CRM lock
+info    241    node1/crm: exit (loop end)
+info    241     shutdown: execute power node1 off
+info    241    node2/crm: got lock 'ha_manager_lock'
+info    241    node2/crm: status change slave => master
+info    241    node2/crm: node 'node1': state changed from 'online' => 'unknown'
+info    241    node2/crm: service 'vm:101': state changed from 'migrate' to 'started'  (node = node1)
+info    320      cmdlist: execute power node1 on
+info    320    node1/crm: status change startup => wait_for_quorum
+info    320    node1/lrm: status change startup => wait_for_agent_lock
+info    320    node1/crm: status change wait_for_quorum => slave
+info    321    node1/lrm: got lock 'ha_agent_node1_lock'
+info    321    node1/lrm: status change wait_for_agent_lock => active
+info    321    node1/lrm: starting service vm:101
+info    321    node1/lrm: service status vm:101 started
+info    322    node2/crm: node 'node1': state changed from 'unknown' => 'online'
+info    341    node1/lrm: status change active => maintenance
+info    342    node2/crm: node 'node1': state changed from 'online' => 'maintenance'
+info    342    node2/crm: migrate service 'vm:101' to node 'node2' (running)
+info    342    node2/crm: service 'vm:101': state changed from 'started' to 'migrate'  (node = node1, target = node2)
+info    361    node1/lrm: service vm:101 - start migrate to node 'node2'
+info    361    node1/lrm: service vm:101 - end migrate to node 'node2'
+info    362    node2/crm: service 'vm:101': state changed from 'migrate' to 'started'  (node = node2)
+info    363    node2/lrm: starting service vm:101
+info    363    node2/lrm: service status vm:101 started
+info    920     hardware: exit simulation - done
diff --git a/src/test/test-crm-maintenance-request4/manager_status b/src/test/test-crm-maintenance-request4/manager_status
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/src/test/test-crm-maintenance-request4/service_config b/src/test/test-crm-maintenance-request4/service_config
new file mode 100644 (file)
index 0000000..0e05ab4
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "vm:101": { "node": "node1", "state": "enabled" },
+    "vm:102": { "node": "node2" },
+    "vm:103": { "node": "node3", "state": "enabled" }
+}
\ No newline at end of file