use correct local IP address helper

this always uses an explicit CIDR, so we don't need a round-trip via
datacenter.cfg ..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2019-11-06 13:36:37 +01:00
committed by Thomas Lamprecht
parent 83a9960c71
commit a2aae38c4b

View File

@ -309,7 +309,10 @@ __PACKAGE__->register_method ({
} elsif ($filename =~ m!^tcp://(([^/]+)(/\d+)?)$!) {
my ($cidr, $ip, $subnet) = ($1, $2, $3);
if ($subnet) { # got real CIDR notation, not just IP
$ip = PVE::Cluster::get_local_migration_ip($cidr);
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];
}
my $family = PVE::Tools::get_host_address_family($ip);
my $port = PVE::Tools::next_migrate_port($family, $ip);