From: Thomas Lamprecht Date: Wed, 22 Feb 2017 15:59:11 +0000 (+0100) Subject: pvecm add: assert that ringX IPs are available on node add X-Git-Url: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff_plain;h=f566b424ce54445285922ad14db7cd85d2d54994 pvecm add: assert that ringX IPs are available on node add If 'ringX_addr' parameters are used on adding a node to a cluster check if those addresses are actually configured on the to-be-added node. It makes no sense that the address is not or multiple times configured. This prevents a node in limbo, waiting for quorum (if it was the second node in a cluster, even two node would be in the no-quorum limbo) where manual pmxcfs kills, local starts and manual configuration edits which may need to get manually synced to other cluster members are needed. The check does not cost much and gets only made on node additions, so assert with our get_local_ip_from_cidr method that the IP is configured on any interface. Signed-off-by: Thomas Lamprecht --- diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm index df94c2e..4366066 100755 --- a/data/PVE/CLI/pvecm.pm +++ b/data/PVE/CLI/pvecm.pm @@ -536,6 +536,21 @@ __PACKAGE__->register_method ({ } } + # check if corosync ring IPs are configured on the current nodes interfaces + my $check_ip = sub { + my $ip = shift; + if (defined($ip)) { + my $cidr = (Net::IP::ip_is_ipv6($ip)) ? "$ip/128" : "$ip/32"; + my $configured_ips = PVE::Network::get_local_ip_from_cidr($cidr); + + &$error("cannot use IP '$ip', it must be configured exactly once on local node!\n") + if (scalar(@$configured_ips) != 1); + } + }; + + &$check_ip($param->{ring0_addr}); + &$check_ip($param->{ring1_addr}); + warn "warning, ignore the following errors:\n$warnings" if $warnings; die "detected the following error(s):\n$errors" if $errors;