the get_protected_ha_{agent, manager}_lock methods should update the
watchdog when the lock could be secured.
If the watchdog file handle was not present we only opened it but
didn't do an update, this fixes that.

Signed-off-by: Thomas Lamprecht <[email protected]>
---
 src/PVE/HA/CRM.pm | 7 ++++---
 src/PVE/HA/LRM.pm | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/PVE/HA/CRM.pm b/src/PVE/HA/CRM.pm
index 4196bba..3769829 100644
--- a/src/PVE/HA/CRM.pm
+++ b/src/PVE/HA/CRM.pm
@@ -92,12 +92,13 @@ sub get_protected_ha_manager_lock {
     for (;;) {
        
        if ($haenv->get_ha_manager_lock()) {
-           if ($self->{ha_manager_wd}) {
-               $haenv->watchdog_update($self->{ha_manager_wd});
-           } else {
+           if (!$self->{ha_manager_wd}) {
                my $wfh = $haenv->watchdog_open();
                $self->{ha_manager_wd} = $wfh;
            }
+           # always update the watchdog when we get the lock
+           $haenv->watchdog_update($self->{ha_manager_wd});
+
            return 1;
        }
            
diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index 1fe5f67..d448547 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -139,12 +139,13 @@ sub get_protected_ha_agent_lock {
     for (;;) {
        
        if ($haenv->get_ha_agent_lock()) {
-           if ($self->{ha_agent_wd}) {
-               $haenv->watchdog_update($self->{ha_agent_wd});
-           } else {
+           if (!$self->{ha_agent_wd}) {
                my $wfh = $haenv->watchdog_open();
                $self->{ha_agent_wd} = $wfh;
            }
+           # always update the watchdog when we get the lock
+           $haenv->watchdog_update($self->{ha_agent_wd});
+
            return 1;
        }
            
-- 
2.1.4


_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to