public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Rusovac <d.rusovac@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-ha-manager v5 04/10] test: add test for ignoring maintenance mode request
Date: Thu, 19 Nov 2026 10:59:25 +0100	[thread overview]
Message-ID: <20261119095931.1748970-5-d.rusovac@proxmox.com> (raw)
In-Reply-To: <20261119095931.1748970-1-d.rusovac@proxmox.com>

none of the existing tests covers the cases where the CRM ignores a
request to enable maintenance mode for a node that is already in
maintenance mode or while the HA stack is disarmed

Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
---

Notes:
    new in v5

 src/test/test-crm-maintenance-request6/README |  3 +
 .../test-crm-maintenance-request6/cmdlist     |  9 ++
 .../hardware_status                           |  5 ++
 .../test-crm-maintenance-request6/log.expect  | 82 +++++++++++++++++++
 .../manager_status                            |  1 +
 .../service_config                            |  5 ++
 6 files changed, 105 insertions(+)
 create mode 100644 src/test/test-crm-maintenance-request6/README
 create mode 100644 src/test/test-crm-maintenance-request6/cmdlist
 create mode 100644 src/test/test-crm-maintenance-request6/hardware_status
 create mode 100644 src/test/test-crm-maintenance-request6/log.expect
 create mode 100644 src/test/test-crm-maintenance-request6/manager_status
 create mode 100644 src/test/test-crm-maintenance-request6/service_config

diff --git a/src/test/test-crm-maintenance-request6/README b/src/test/test-crm-maintenance-request6/README
new file mode 100644
index 0000000..a7a510f
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/README
@@ -0,0 +1,3 @@
+Test that the CRM ignores requests to enable the maintenance mode for a node
+that is already in maintenance mode, and while the HA stack is disarmed,
+respectively.
diff --git a/src/test/test-crm-maintenance-request6/cmdlist b/src/test/test-crm-maintenance-request6/cmdlist
new file mode 100644
index 0000000..574ee6a
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/cmdlist
@@ -0,0 +1,9 @@
+[
+    [ "power node1 on", "power node2 on", "power node3 on"],
+    [ "crm node3 enable-node-maintenance" ],
+    [ "crm node3 enable-node-maintenance" ],
+    [ "crm node1 disarm-ha freeze" ],
+    [ "crm node2 enable-node-maintenance" ],
+    [ "crm node1 arm-ha" ],
+    [ "crm node3 disable-node-maintenance" ]
+]
diff --git a/src/test/test-crm-maintenance-request6/hardware_status b/src/test/test-crm-maintenance-request6/hardware_status
new file mode 100644
index 0000000..451beb1
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/hardware_status
@@ -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-request6/log.expect b/src/test/test-crm-maintenance-request6/log.expect
new file mode 100644
index 0000000..1db9138
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/log.expect
@@ -0,0 +1,82 @@
+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 node3 enable-node-maintenance
+info    125    node3/lrm: status change active => maintenance
+info    140    node1/crm: node 'node3': state changed from 'online' => 'maintenance'
+info    140    node1/crm: migrate service 'vm:103' to node 'node2' (running)
+info    140    node1/crm: service 'vm:103': state changed from 'started' to 'migrate'  (node = node3, target = node2)
+info    145    node3/lrm: service vm:103 - start migrate to node 'node2'
+info    145    node3/lrm: service vm:103 - end migrate to node 'node2'
+info    160    node1/crm: service 'vm:103': state changed from 'migrate' to 'started'  (node = node2)
+info    163    node2/lrm: starting service vm:103
+info    163    node2/lrm: service status vm:103 started
+info    220      cmdlist: execute crm node3 enable-node-maintenance
+info    220    node1/crm: ignoring crm command - node node3 is already in maintenance state
+info    320      cmdlist: execute crm node1 disarm-ha freeze
+info    320    node1/crm: got crm command: disarm-ha freeze
+info    320    node1/crm: disarm: freezing service 'vm:101' (was 'started')
+info    320    node1/crm: disarm: freezing service 'vm:102' (was 'stopped')
+info    320    node1/crm: disarm: freezing service 'vm:103' (was 'started')
+info    321    node1/lrm: HA disarm requested, releasing agent lock and watchdog
+info    321    node1/lrm: status change active => wait_for_agent_lock
+info    323    node2/lrm: HA disarm requested, releasing agent lock and watchdog
+info    323    node2/lrm: status change active => wait_for_agent_lock
+info    340    node1/crm: all LRMs disarmed, HA stack is now fully disarmed
+info    340    node1/crm: HA stack fully disarmed, releasing CRM watchdog
+info    420      cmdlist: execute crm node2 enable-node-maintenance
+warn    420    node1/crm: ignoring maintenance command for node node2 - HA stack is disarmed
+info    520      cmdlist: execute crm node1 arm-ha
+info    520    node1/crm: got crm command: arm-ha
+info    520    node1/crm: re-arming HA stack
+info    540    node1/crm: service 'vm:101': state changed from 'freeze' to 'started'
+info    540    node1/crm: service 'vm:102': state changed from 'freeze' to 'request_stop'
+info    540    node1/crm: service 'vm:103': state changed from 'freeze' to 'started'
+info    541    node1/lrm: got lock 'ha_agent_node1_lock'
+info    541    node1/lrm: status change wait_for_agent_lock => active
+info    543    node2/lrm: got lock 'ha_agent_node2_lock'
+info    543    node2/lrm: status change wait_for_agent_lock => active
+info    560    node1/crm: service 'vm:102': state changed from 'request_stop' to 'stopped'
+info    620      cmdlist: execute crm node3 disable-node-maintenance
+info    625    node3/lrm: got lock 'ha_agent_node3_lock'
+info    625    node3/lrm: status change maintenance => active
+info    640    node1/crm: node 'node3': state changed from 'maintenance' => 'online'
+info    640    node1/crm: moving service 'vm:103' back to 'node3', node came back from maintenance.
+info    640    node1/crm: migrate service 'vm:103' to node 'node3' (running)
+info    640    node1/crm: service 'vm:103': state changed from 'started' to 'migrate'  (node = node2, target = node3)
+info    643    node2/lrm: service vm:103 - start migrate to node 'node3'
+info    643    node2/lrm: service vm:103 - end migrate to node 'node3'
+info    660    node1/crm: service 'vm:103': state changed from 'migrate' to 'started'  (node = node3)
+info    665    node3/lrm: starting service vm:103
+info    665    node3/lrm: service status vm:103 started
+info   1220     hardware: exit simulation - done
diff --git a/src/test/test-crm-maintenance-request6/manager_status b/src/test/test-crm-maintenance-request6/manager_status
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/manager_status
@@ -0,0 +1 @@
+{}
diff --git a/src/test/test-crm-maintenance-request6/service_config b/src/test/test-crm-maintenance-request6/service_config
new file mode 100644
index 0000000..c943ba6
--- /dev/null
+++ b/src/test/test-crm-maintenance-request6/service_config
@@ -0,0 +1,5 @@
+{
+    "vm:101": { "node": "node1", "state": "started" },
+    "vm:102": { "node": "node2" },
+    "vm:103": { "node": "node3", "state": "started" }
+}
\ No newline at end of file
-- 
2.47.3





  parent reply	other threads:[~2026-11-19 10:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:59 [PATCH-SERIES docs/ha-manager/manager v5 00/10] fix #6144: add api and ui for node maintenance mode Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-manager v5 01/10] fix #6144: api: nodes: add endpoint to set " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-manager v5 02/10] fix #6144: ui: ha: status: allow toggling " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-manager v5 03/10] ui: ha: status: show spinner while maintenance mode request is queued Dominik Rusovac
2026-11-19  9:59 ` Dominik Rusovac [this message]
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 05/10] manager: standardize log messages for maintenance mode request Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 06/10] manager: factor out check " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 07/10] cli: reject maintenance mode requests rejected by crm Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 08/10] api: status: report maintenance mode request for lrm entries Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 09/10] api: status: report queued " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-docs v5 10/10] ha-manager: maintenance mode: mention web ui menu Dominik Rusovac
2026-11-19 22:28 ` applied: [PATCH-SERIES docs/ha-manager/manager v5 00/10] fix #6144: add api and ui for node maintenance mode Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119095931.1748970-5-d.rusovac@proxmox.com \
    --to=d.rusovac@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal