From ed2df8e35e0b3f275aaad566c9faab5f83b503b7 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 8 Nov 2019 12:19:04 +0100 Subject: [PATCH] followup: different error messages for no and to many IPs Signed-off-by: Thomas Lamprecht --- PVE/CLI/pvesm.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm index 161b0a3..01ddd23 100755 --- a/PVE/CLI/pvesm.pm +++ b/PVE/CLI/pvesm.pm @@ -310,9 +310,12 @@ __PACKAGE__->register_method ({ my ($cidr, $ip, $subnet) = ($1, $2, $3); if ($subnet) { # got real CIDR notation, not just IP my $ips = PVE::Network::get_local_ip_from_cidr($cidr); - die "Unable to get single local IP address in network '$cidr'\n" - if scalar(@$ips) != 1; - $ip = @$ips[0]; + die "Unable to get any local IP address in network '$cidr'\n" + if scalar(@$ips) < 1; + die "Got multiple local IP address in network '$cidr'\n" + if scalar(@$ips) > 1; + + $ip = $ips->[0]; } my $family = PVE::Tools::get_host_address_family($ip); my $port = PVE::Tools::next_migrate_port($family, $ip);