]> git.proxmox.com Git - pve-cluster.git/commitdiff
cache address families for known nodes
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 21 May 2015 11:07:41 +0000 (13:07 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 21 May 2015 11:13:03 +0000 (13:13 +0200)
data/PVE/Cluster.pm

index 69eda6d5efaaa4164b6559c3c9b5efb7042b0ec7..09ddf01d93b1ec1bfde1b5b94930cffad962ce22 100644 (file)
@@ -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);
        }
     }