]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
manager: ensure node-request state transferred to new active CRM
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 19 Apr 2023 12:24:23 +0000 (14:24 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 Apr 2023 12:10:18 +0000 (14:10 +0200)
We do not just take the full CRM status of the old master if a new
one gets active, we only take over the most relevant parts like node
state. But the relative new node_request object entry is also
important, as without that a maintenance state request may get lost
if a new CRM becomes the active master.

Simply copy it over on initial manager construction, if it exists.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Manager.pm
src/test/test-crm-maintenance-request3/log.expect

index 0d0cad240bd34387467b71e683d1352a64adf44e..e63d2812f590e3b7c41a0b3c421c3601d044a5dc 100644 (file)
@@ -54,6 +54,10 @@ sub new {
 
     $self->{ms} = { master_node => $haenv->nodename() };
 
+    # take over node request state to ensure a node in (manual) maintenance mode stays that way
+    # on change of active master.
+    $self->{ms}->{node_request} = $old_ms->{node_request} if defined($old_ms->{node_request});
+
     $self->update_crs_scheduler_mode(); # initial set, we update it once every loop
 
     return $self;
index ed32fd314edef2e82348d6430c6286677c713cf7..5e023e9206720bfb4b12b9fddcc3b765c40ea658 100644 (file)
@@ -56,15 +56,4 @@ 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