[pve-devel] [PATCH 1/4] cache address families for known nodes

Wolfgang Bumiller w.bumiller at proxmox.com
Thu May 21 13:07:41 CEST 2015


---
 data/PVE/Cluster.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 69eda6d..09ddf01 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1010,8 +1010,14 @@ sub remote_node_ip {
     my $nodelist = $clinfo->{nodelist};
     if ($nodelist && $nodelist->{$nodename}) {
 	if (my $ip = $nodelist->{$nodename}->{ip}) {
-	    return wantarray ? ($ip, PVE::Tools::get_host_address_family($ip))
-	                     : $ip;
+	    return $ip if !wantarray;
+	    my $family = $nodelist->{$nodename}->{address_family};
+	    if (!$family) {
+		$nodelist->{$nodename}->{address_family} =
+		    $family =
+		    PVE::Tools::get_host_address_family($ip);
+	    }
+	    return ($ip, $family);
 	}
     }
 
-- 
2.1.4




More information about the pve-devel mailing list