]> git.proxmox.com Git - pve-storage.git/commitdiff
followup: different error messages for no and to many IPs
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 8 Nov 2019 11:19:04 +0000 (12:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 8 Nov 2019 11:19:04 +0000 (12:19 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/CLI/pvesm.pm

index 161b0a343e7e62b6c126a939b76c20dce854bc62..01ddd23c026787a4ca9f7a6e9d42232c50c73f3b 100755 (executable)
@@ -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);