[pve-devel] [PATCH ha-manager v3 1/3] cleanup manager status on start
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Jun 17 17:11:14 CEST 2016
Cleanup the manager state if we get promoted to manager to avoid
deletions of deprecated hash entries.
Just safe:
* service status: as it may contain unprocessed results
* relocate tried nodes: so we do not accidentally restart the start
failure policy on a manager restart (e.g. update)
* manager_node: this is set only once before this cleanup so do not
delete it.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
new in this version
src/PVE/HA/Manager.pm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 1208720..017e4b2 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -30,6 +30,8 @@ sub new {
ss => $ss, # service status
}, $class;
+ $self->cleanup_manager_status();
+
return $self;
}
@@ -39,6 +41,23 @@ sub cleanup {
# todo: ?
}
+sub cleanup_manager_status {
+ my ($self) = @_;
+
+ my $ms = $self->{ms};
+ my $new_state = {};
+
+ # safe only the state part of the manager which cannot be auto generated
+ my @key_withelist = qw(service_status relocate_tried_nodes master_node);
+
+ foreach my $k (@key_withelist) {
+ next if !$ms->{$k};
+ $new_state->{$k} = $ms->{$k};
+ }
+
+ $self->{ms} = $new_state;
+}
+
sub flush_master_status {
my ($self) = @_;
--
2.1.4
More information about the pve-devel
mailing list