Esempio n. 1
0
        private void ResolveReplNets(ClusterNic localNic, List <ClusterNetwork> unassignedNets)
        {
            List <PingRequest> list = new List <PingRequest>(30);

            foreach (ClusterNetwork clusterNetwork in unassignedNets)
            {
                if (clusterNetwork.LogicalNetwork == null && !this.DoesClusterNetworkContainNode(clusterNetwork, localNic.NodeName))
                {
                    this.SelectPingCandidates(clusterNetwork, list);
                }
            }
            if (list.Count > 0)
            {
                PingRequest[] array      = list.ToArray();
                PingProber    pingProber = null;
                try
                {
                    pingProber = new PingProber(localNic.IPAddress);
                    pingProber.SendPings(array);
                    pingProber.GatherReplies(3000);
                    foreach (PingRequest pingRequest in array)
                    {
                        if (pingRequest.Success)
                        {
                            ClusterNic clusterNic = (ClusterNic)pingRequest.UserContext;
                            if (clusterNic.ClusterNetwork.LogicalNetwork == null)
                            {
                                Subnet subnet = this.GetSubnet(clusterNic.ClusterNetwork.SubnetId);
                                clusterNic.ClusterNetwork.LogicalNetwork = localNic.ClusterNetwork.LogicalNetwork;
                                clusterNic.ClusterNetwork.LogicalNetwork.Add(subnet);
                            }
                        }
                    }
                }
                catch (SocketException arg)
                {
                    NetworkDiscovery.Tracer.TraceError <IPAddress, SocketException>((long)this.GetHashCode(), "Prober failed from {0}:{1}", localNic.IPAddress, arg);
                }
                finally
                {
                    if (pingProber != null)
                    {
                        pingProber.Dispose();
                    }
                }
            }
        }
Esempio n. 2
0
        private void ResolveLocalNic(ClusterNic localNic)
        {
            Subnet subnet = this.GetSubnet(localNic.ClusterNetwork.SubnetId);

            if (localNic.ClusterState == AmNetInterfaceState.Up)
            {
                List <LogicalNetwork> list = this.FindLogicalNetsWithoutNode(localNic.NodeName);
                if (list.Count > 0)
                {
                    List <PingRequest> list2 = new List <PingRequest>(list.Count * 3);
                    foreach (LogicalNetwork logicalNetwork in list)
                    {
                        foreach (Subnet subnet2 in logicalNetwork.Subnets)
                        {
                            if (subnet2.ClusterNetwork != null)
                            {
                                this.SelectPingCandidates(subnet2.ClusterNetwork, list2);
                            }
                        }
                    }
                    if (list2.Count > 0)
                    {
                        PingRequest[] array      = list2.ToArray();
                        PingProber    pingProber = null;
                        try
                        {
                            pingProber = new PingProber(localNic.IPAddress);
                            pingProber.SendPings(array);
                            pingProber.GatherReplies(3000);
                            foreach (PingRequest pingRequest in array)
                            {
                                if (pingRequest.Success)
                                {
                                    ClusterNic clusterNic = (ClusterNic)pingRequest.UserContext;
                                    localNic.ClusterNetwork.LogicalNetwork = clusterNic.ClusterNetwork.LogicalNetwork;
                                    localNic.ClusterNetwork.LogicalNetwork.Add(subnet);
                                    break;
                                }
                            }
                        }
                        catch (SocketException arg)
                        {
                            NetworkDiscovery.Tracer.TraceError <IPAddress, SocketException>((long)this.GetHashCode(), "Prober failed from {0}:{1}", localNic.IPAddress, arg);
                        }
                        finally
                        {
                            if (pingProber != null)
                            {
                                pingProber.Dispose();
                            }
                        }
                    }
                }
            }
            if (localNic.ClusterNetwork.LogicalNetwork == null)
            {
                LogicalNetwork logicalNetwork2 = this.AddNewLogicalNetwork();
                logicalNetwork2.Add(subnet);
                localNic.ClusterNetwork.LogicalNetwork = logicalNetwork2;
            }
        }