]> git.proxmox.com Git - pve-cluster.git/commitdiff
fix #3596: handle delnode of offline node
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 12 Nov 2021 08:45:27 +0000 (09:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 12 Nov 2021 10:04:05 +0000 (11:04 +0100)
the recommended way is to first shutdown, then delnode, and never let it
come back online, in which case corosync-cfgtool won't be able to kill
the removed (offline) node.

also, the order was wrong - if we first update corosync.conf to remove
the node entry from the nodelist, corosync doesn't know about the nodeid
anymore, so killing will fail even if the node is still online.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
data/PVE/API2/ClusterConfig.pm

index 8f4a5bbe88e18d668bba64dcf8263a823d6aeaa9..5a6a1accd8b3c487f572daed8fdd319f60b00a2b 100644 (file)
@@ -485,9 +485,13 @@ __PACKAGE__->register_method ({
 
            delete $nodelist->{$node};
 
-           PVE::Corosync::update_nodelist($conf, $nodelist);
+           # allowed to fail when node is already shut down!
+           eval {
+               PVE::Tools::run_command(['corosync-cfgtool','-k', $nodeid])
+                   if defined($nodeid);
+           };
 
-           PVE::Tools::run_command(['corosync-cfgtool','-k', $nodeid]) if defined($nodeid);
+           PVE::Corosync::update_nodelist($conf, $nodelist);
        };
 
        $config_change_lock->($code);