[pve-devel] [PATCH cluster 1/2] pvecm: check early if the deletion cannot work

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 23 12:12:04 CET 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/CLI/pvecm.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 9437368..ba72bfe 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -412,6 +412,9 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	my $local_node = PVE::INotify::nodename();
+	die "Cannot delete myself from cluster!\n" if $param->{node} eq $local_node;
+
 	PVE::Cluster::check_cfs_quorum();
 
 	my $code = sub {
@@ -437,9 +440,6 @@ __PACKAGE__->register_method ({
 	    die "Node/IP: $param->{node} is not a known host of the cluster.\n"
 		if !defined($node);
 
-	    my $our_nodename = PVE::INotify::nodename();
-	    die "Cannot delete myself from cluster!\n" if $node eq $our_nodename;
-
 	    delete $nodelist->{$node};
 
 	    PVE::Corosync::update_nodelist($conf, $nodelist);
-- 
2.11.0





More information about the pve-devel mailing list