mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-04 17:11:06 +01:00
CA-165096: solve XenCenter slow to find RDP interface
To solve this long latency issue, we will only scan IPs whose PIF link status is connected. Signed-off-by: Cheng Zhang <cheng.zhang@citrix.com>
This commit is contained in:
parent
a2bb28a997
commit
8519fab118
@ -354,18 +354,28 @@ namespace XenAdmin.ConsoleView
|
|||||||
List<string> ipAddresses = new List<string>();
|
List<string> ipAddresses = new List<string>();
|
||||||
List<string> ipv6Addresses = new List<string>();
|
List<string> ipv6Addresses = new List<string>();
|
||||||
|
|
||||||
foreach (String key in networks.Keys)
|
foreach (VIF vif in vm.Connection.ResolveAll(vm.VIFs))
|
||||||
{
|
{
|
||||||
if (key.EndsWith("ip")) // IPv4 address
|
XenAPI.Network network = vif.Connection.Resolve(vif.network);
|
||||||
ipAddresses.Add(networks[key]);
|
XenAPI.Host host = vm.Connection.Resolve(vm.resident_on);
|
||||||
|
XenAPI.PIF pif = Helpers.FindPIF(network, host);
|
||||||
|
if (pif.LinkStatus == PIF.LinkState.Connected)
|
||||||
|
{
|
||||||
|
foreach (var networkInfo in networks.Where(n => n.Key.StartsWith(String.Format("{0}/ip", vif.device))))
|
||||||
|
{
|
||||||
|
if (networkInfo.Key.EndsWith("ip")) // IPv4 address
|
||||||
|
ipAddresses.Add(networkInfo.Value);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (key.Contains("ipv6")) // IPv6 address, enclose in square brackets
|
if (networkInfo.Key.Contains("ipv6")) // IPv6 address, enclose in square brackets
|
||||||
ipv6Addresses.Add(String.Format("[{0}]", networks[key]));
|
ipv6Addresses.Add(String.Format("[{0}]", networkInfo.Value));
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ipAddresses.AddRange(ipv6Addresses); // make sure IPv4 addresses are scanned first (CA-102755)
|
ipAddresses.AddRange(ipv6Addresses); // make sure IPv4 addresses are scanned first (CA-102755)
|
||||||
|
|
||||||
foreach (String ipAddress in ipAddresses)
|
foreach (String ipAddress in ipAddresses)
|
||||||
|
Loading…
Reference in New Issue
Block a user