]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
handle the case where a node gets fully removed
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 10 Apr 2019 10:41:17 +0000 (12:41 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 10 Apr 2019 10:41:19 +0000 (12:41 +0200)
If an admin removes a node he may also remove /etc/pve/nodes/NODE
quite soon after that, if the "node really deleted" logic of our
NodeStatus module has not triggered until then (it waits an hour) the
current manager still tries to read the gone nodes LRM status, which
results in an exception. Move this exception to a warn and return a
node == unkown state in such a case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Config.pm

index 98a9a32bb89dfff097910740f48ba41e592a502e..ead1ee280f0083ec5bab4b971fa3f7e4b611985d 100644 (file)
@@ -51,8 +51,13 @@ sub read_lrm_status {
     my $cfs_path = "nodes/$node/lrm_status";
 
     my $raw = PVE::Cluster::get_config($cfs_path);
-    die "unable to read file '/etc/pve/$cfs_path'\n"
-       if !defined($raw);
+    if (!defined($raw)) {
+       # ENOENT -> possible deleted node, don't die here as it breaks our node
+       # 'gone' logic
+       warn "unable to read file '/etc/pve/$cfs_path'\n";
+       # unkown mode set explicitly as 'active' is assumed as default..
+       return { mode => 'unknown' } if ! -e "/etc/pve/$cfs_path";
+    }
 
     return json_reader(undef, $raw);
 }