[pve-devel] [PATCH storage 1/6] use correct local IP address helper

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Nov 6 13:36:37 CET 2019


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 at proxmox.com>
---
 PVE/CLI/pvesm.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index ae1bc3d..161b0a3 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -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);
-- 
2.20.1





More information about the pve-devel mailing list