]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
test behavior of shutdown with maintenance mode on active master
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 19 Apr 2023 12:16:21 +0000 (14:16 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 Apr 2023 12:10:18 +0000 (14:10 +0200)
this encode the current bad behavior of the maintenance mode getting
lost on active CRM switch, due to the request node state not being
transferred. Will be fixed in the next commit.

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

diff --git a/src/test/test-crm-maintenance-request3/README b/src/test/test-crm-maintenance-request3/README
new file mode 100644 (file)
index 0000000..6095306
--- /dev/null
@@ -0,0 +1,3 @@
+Test setting the maintenance mode for the node that is the current active
+master manually, then reboot it and ensure that maintenance mode doesn't get
+cleared automatically that way.
diff --git a/src/test/test-crm-maintenance-request3/cmdlist b/src/test/test-crm-maintenance-request3/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-request3/datacenter.cfg b/src/test/test-crm-maintenance-request3/datacenter.cfg
new file mode 100644 (file)
index 0000000..de0bf81
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "ha": {
+        "shutdown_policy": "migrate"
+    }
+}
diff --git a/src/test/test-crm-maintenance-request3/hardware_status b/src/test/test-crm-maintenance-request3/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-request3/log.expect b/src/test/test-crm-maintenance-request3/log.expect
new file mode 100644 (file)
index 0000000..ed32fd3
--- /dev/null
@@ -0,0 +1,70 @@
+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 'migrate'
+info    220    node1/lrm: shutdown LRM, doing maintenance, removing this node from active list
+info    222    node1/lrm: exit (loop end)
+info    222     shutdown: execute crm node1 stop
+info    221    node1/crm: server received shutdown request
+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    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    322    node2/crm: node 'node1': state changed from 'maintenance' => 'online'
+info    322    node2/crm: moving service 'vm:101' back to 'node1', node came back from maintenance.
+info    322    node2/crm: migrate service 'vm:101' to node 'node1' (running)
+info    322    node2/crm: service 'vm:101': state changed from 'started' to 'migrate'  (node = node2, target = node1)
+info    323    node2/lrm: service vm:101 - start migrate to node 'node1'
+info    323    node2/lrm: service vm:101 - end migrate to node 'node1'
+info    342    node2/crm: service 'vm:101': state changed from 'migrate' to 'started'  (node = node1)
+info    361    node1/lrm: got lock 'ha_agent_node1_lock'
+info    361    node1/lrm: status change wait_for_agent_lock => active
+info    361    node1/lrm: starting service vm:101
+info    361    node1/lrm: service status vm:101 started
+info    920     hardware: exit simulation - done
diff --git a/src/test/test-crm-maintenance-request3/manager_status b/src/test/test-crm-maintenance-request3/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-request3/service_config b/src/test/test-crm-maintenance-request3/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