[pve-devel] [PATCH ha-manager 1/4] fix relocate/restart trial count leak on service deletion

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 3 10:03:14 CEST 2016


If a service gets remove from HA remove also its relocate and
restart trial count from LRM status and manager_status, else it
never gets deleted (leak).

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/LRM.pm     | 4 ++++
 src/PVE/HA/Manager.pm | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index fcbc33f..d49873f 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -438,6 +438,10 @@ sub manage_resources {
 
     my $ss = $self->{service_status};
 
+    foreach my $sid (keys %{$self->{restart_tries}}) {
+	delete $self->{restart_tries}->{$sid} if !$ss->{$sid};
+    }
+
     foreach my $sid (keys %$ss) {
 	my $sd = $ss->{$sid};
 	next if !$sd->{node};
diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 627036b..9b29901 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -341,7 +341,12 @@ sub manage {
 	$haenv->log('info', "removing stale service '$sid' (no config)");
 	delete $ss->{$sid};
     }
-    
+
+    # remove stale relocation try entries
+    foreach my $sid (keys %{$ms->{relocate_trial}}) {
+	delete $ms->{relocate_trial}->{$sid} if !$ss->{$sid};
+    }
+
     $self->update_crm_commands();
 
     for (;;) {
-- 
2.1.4





More information about the pve-devel mailing list