Merge pull request #1665 from minglumlu/private/mingl/CA-254479

CA-254479,CA-223802,XSO-672: distinct the VM IP addresses which are r…
This commit is contained in:
Mihaela Stoica 2017-07-03 09:59:18 +01:00 committed by GitHub
commit 743e9938da
4 changed files with 11 additions and 4 deletions

View File

@ -803,6 +803,7 @@ namespace XenAdmin.Actions
}
}
}
addresses = new ComparableList<ComparableAddress>(addresses.Distinct());
if (MacInfo.Length == 0)
MacInfo = Messages.HYPHEN;

View File

@ -366,7 +366,7 @@ namespace XenAdmin.ConsoleView
PIF pif = Helpers.FindPIF(network, host);
foreach (var networkInfo in networks.Where(n => n.Key.StartsWith(String.Format("{0}/ip", vif.device))))
{
if (networkInfo.Key.EndsWith("ip")) // IPv4 address
if (networkInfo.Key.EndsWith("ip") || networkInfo.Key.Contains("ipv4")) // IPv4 address
{
if (pif == null)
ipAddressesForNetworksWithoutPifs.Add(networkInfo.Value);
@ -387,6 +387,7 @@ namespace XenAdmin.ConsoleView
}
}
}
ipAddresses = ipAddresses.Distinct().ToList();
ipAddresses.AddRange(ipv6Addresses); // make sure IPv4 addresses are scanned first (CA-102755)
// add IP addresses for networks without PIFs

View File

@ -63,13 +63,15 @@ namespace XenAPI
if (vmGuestMetrics != null)
{
// PR-1373 - VM_guest_metrics.networks is a dictionary of IP addresses in the format:
// [["0/ip", <IPv4 address>], ["0/ipv6/0", <IPv6 address>], ["0/ipv6/1", <IPv6 address>]]
// [["0/ip", <IPv4 address>],
// ["0/ipv4/0", <IPv4 address>], ["0/ipv4/1", <IPv4 address>],
// ["0/ipv6/0", <IPv6 address>], ["0/ipv6/1", <IPv6 address>]]
return
(from network in vmGuestMetrics.networks
where network.Key.StartsWith(string.Format("{0}/ip", this.device))
orderby network.Key
select network.Value).ToList();
select network.Value).Distinct().ToList();
}
}

View File

@ -1123,7 +1123,9 @@ namespace XenAdmin.XenSearch
foreach (VIF vif in vifs)
{
// PR-1373 - VM_guest_metrics.networks is a dictionary of IP addresses in the format:
// [["0/ip", <IPv4 address>], ["0/ipv6/0", <IPv6 address>], ["0/ipv6/1", <IPv6 address>]]
// [["0/ip", <IPv4 address>],
// ["0/ipv4/0", <IPv4 address>], ["0/ipv4/1", <IPv4 address>],
// ["0/ipv6/0", <IPv6 address>], ["0/ipv6/1", <IPv6 address>]]
foreach (var network in metrics.networks.Where(n => n.Key.StartsWith(String.Format("{0}/ip", vif.device))))
{
ComparableAddress ipAddress;
@ -1133,6 +1135,7 @@ namespace XenAdmin.XenSearch
addresses.Add(ipAddress);
}
}
addresses =new ComparableList<ComparableAddress>(addresses.Distinct());
}
else if (o is Host)
{