[pve-devel] [PATCH ha-manager 1/2] LRM: release lcok also on restart

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 18 11:35:20 CET 2016


Wen restarting the LRM (e.g. on a update) we get an new pid and thus
have to wait for our own lock to timeout.
We can (and should) do that as there are no services or all services
are freezed. If they are freezed only our LRM may touch them so we
we can unfreeze them faster with this patch.

The expected log of the restart-lrm test does not change much as the
test system does not need to wait for a timeout.

This let's the LRM start working directly after a restart,
especially usefull on package updates.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/LRM.pm                    | 3 +++
 src/test/test-restart-lrm/log.expect | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index 60ee448..30df766 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -282,6 +282,9 @@ sub do_one_iteration {
 			    }
 
 			    $shutdown = 1;
+
+			    # restart with no or freezed services, release the lock
+			    $haenv->release_ha_agent_lock();
 			}
 		    }
 		} else {
diff --git a/src/test/test-restart-lrm/log.expect b/src/test/test-restart-lrm/log.expect
index 88cbd5a..7e0a71e 100644
--- a/src/test/test-restart-lrm/log.expect
+++ b/src/test/test-restart-lrm/log.expect
@@ -26,5 +26,6 @@ info    120    node1/crm: service 'vm:103': state changed from 'started' to 'fre
 info    126    node3/lrm: exit (loop end)
 info    126    node3/lrm: status change startup => wait_for_agent_lock
 info    160    node1/crm: service 'vm:103': state changed from 'freeze' to 'started' 
+info    165    node3/lrm: got lock 'ha_agent_node3_lock'
 info    165    node3/lrm: status change wait_for_agent_lock => active
 info    720     hardware: exit simulation - done
-- 
2.1.4





More information about the pve-devel mailing list